【发布时间】:2012-05-04 21:49:03
【问题描述】:
我有一个带有 CustomCells 的 UITableView,其中包含一个 TextField。看看我上传的图片。
Picture1Picture2 我希望如果我开始滚动键盘应该隐藏。
我试过了
- (void) scrollViewWillBeginDragging:(UIScrollView *)scrollView
{
NSLog(@"Got called");
ProductTableCell *cell;
[cell.mengeTextField resignFirstResponder];
}
控制台日志:
2012-04-24 12:57:48.924 Book-App[21029:15803] Got called
2012-04-24 12:57:50.535 Book-App[21029:15803] Got called
2012-04-24 12:57:51.681 Book-App[21029:15803] Got called
但这对我不起作用。
还有其他解决方案吗?
【问题讨论】:
-
该方法是否被调用?放置控制台日志并检查它是否被调用?
-
是的,方法正在被调用。我用日志编辑了我的帖子
-
您是否为 UITableView 中的每个文本字段连接了插座??
-
是的,我为文本字段连接了一个插座。它是一个动态的 TableView
-
如果你连接了插座意味着你不需要在这个方法中声明“单元格”。你只需 [myTextField resignFirstResponder];这样做
标签: ios xcode uitableview tableview