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;
}
}
当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;
}
}
相关文章推荐
- 电商商家后台-easyUI的combox三级联动
- quick2.2与quick3.3的区别(2)
- java 基础知识——String & StringBuffer & StringBuilder
- UIAlertView 按钮设置可点或者不可点击
- IOS上 关于状态栏的相关设置(UIStatusBar)
- IOS 定制中间突出UItabBar
- Android UI 之 ViewFlipper 和 GestureDetector
- iOS UISlider用法及自定义滑块
- [HDU] 1711 Number Sequence KMP
- 修改virtualbox的UUID,使virtualbox的虚拟磁盘可以复制
- 文字效果和表情图片:JAVA正则表达式 Pattern和Matcher、SpannableString与SpannableStringBuilder
- Robotium Instrumentation run failed due to 'java.lang.ClassNotFoundException'
- The type java.lang.String cannot be resolved. It is indirectly referenced from required .class files
- UITextField(输入框)
- Fixing common issues when hosting a .NET 4.0 WCF service in IIS 7
- 北大ACM1503——Integer Inquiry
- 前端UI框架
- Havok_2014-1-0_Pc_Xs_User_Guide(目录)
- apue 第十六章 套接字
- EQueue - 一个纯C#写的分布式消息队列介绍2