您的位置:首页 > 产品设计 > UI/UE

Cell上添加UITextField出现的问题解决

2015-08-03 14:12 746 查看
cell上添加UItextField.

当cell进行复用室,如果前一个cell已经消失了,但是cell上的UITextField唤起的键盘还在的话,

那么当点击别的cell上的UITextField的时候。前者无法取消键盘的第一响应,就会出现crash的情况。

这种情况下,通过下列方式进行标记就可以解决这个问题。

- (void)textFieldDidBeginEditing:(UITextField *)textField{

if (textField == companyNameField) {

index = 2;
}else
if (textField == theContactPeopeleField){

index = 3;
}

else if(textField ==
companyTelField){

index = 4;
}else
if(textField==areaNum || textField ==
rootPhoneNum || textField ==
apartNum){

index = 5;
}
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: