0

我的数据数组中有来自网络服务的数据,我想在用户输入电子邮件时自动填充所有数据,它应该加载所有文本字段中的所有数据,我该怎么办?请帮忙

-(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;
    }}

}
4

1 回答 1

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;
}
于 2013-04-06T11:54:21.603 回答