2013-04-06 41 views
0

我有我的數據數據從webservices數據,我想自動填充所有數據時,用戶輸入電子郵件,它應該加載所有文本域中的所有數據,我該怎麼辦?請幫助iphone自動填充註冊表

-(BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 
{ 
    GET_DBHANDLER 
    if (dataArray.count==0) { 
     NSLog(@"sasas"); 
    } 
    else 
    { 
    dataArray = [dbHandler getUserDetails:txtEmail.text]; 
    for (userDC *user in dataArray) { 
     txtFirstName.text = user.firstName; 
     txtSurName.text = user.surName; 
     txtTelephone.text = user.telephone; 
     txtMobile.text = user.mobile; 
     txtBusinessName.text = user.businessName; 
     txtBusinessAddress.text = user.business_address; 
     txtWebSite.text = user.website; 
     txtLinkedIn.text = user.linkedin; 
     txtFaceBook.text = user.facebook; 
     txtTwitter.text = user.twitter; 
     txtAppUserName.text = user.app_username; 
     txtAppPassword.text = user.app_password; 
     txtNetworkUserName.text = user.network_username; 
     txtNetworkPassword.text = user.network_password; 
     txtBNIUserName.text = user.bni_username; 
     txtBNIPassword.text = user.bni_password; 
    }} 

} 
+0

我應該怎麼辦? – NullData 2013-04-06 11:03:52

+0

是否有任何按鈕動作或辭職鍵盤或任何其他知道在文本框中輸入的數據是否完成? – Balu 2013-04-06 11:05:13

+0

不,它應該來自textfield – NullData 2013-04-06 11:07:17

回答

0
-(BOOL) textField:(UITextField *)textField shouldChangeCharactersInRange:(NSRange)range replacementString:(NSString *)string 
{ 
    if (textField.tag == yourEmailTextField.tag) 
    { 
     if([textField.text isEqualToString:yourRequiredEmailID]) 
     { 
      for (userDC *user in dataArray) { 
       txtFirstName.text = user.firstName; 
       txtSurName.text = user.surName; 
       txtTelephone.text = user.telephone; 
       txtMobile.text = user.mobile; 
       txtBusinessName.text = user.businessName; 
       txtBusinessAddress.text = user.business_address; 
       txtWebSite.text = user.website; 
       txtLinkedIn.text = user.linkedin; 
       txtFaceBook.text = user.facebook; 
       txtTwitter.text = user.twitter; 
       txtAppUserName.text = user.app_username; 
       txtAppPassword.text = user.app_password; 
       txtNetworkUserName.text = user.network_username; 
       txtNetworkPassword.text = user.network_password; 
       txtBNIUserName.text = user.bni_username; 
       txtBNIPassword.text = user.bni_password; 
      } 
      return NO; 
     } 
    } 
    return YES; 
}