[英]iOS) HIding Keyboard in a cell in UITableView
-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
{
static NSString *CellIdentifier = @"searchCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
searchField = (UITextField *)[cell viewWithTag:10000];
[searchField resignFirstResponder];
}
Okay, I have a cell with a identifier name of "searchCell". 好的,我有一个标识符名称为“ searchCell”的单元格。 This cell contains one single UITextField with tag 10000 that pops up a keyboard on the bottom of the screen. 该单元格包含一个带有标签10000的UITextField,该UITextField在屏幕底部弹出一个键盘。 When a user touches another cell, the keyboard must be hidden so that the user can have larger space to scroll up and down. 当用户触摸另一个单元格时,必须隐藏键盘,以便用户可以有更大的空间上下滚动。
However, when a keyboard has popped up and a user touches(select) a cell, the code above is called but not working... :( It seems like the assigned UITableViewCell is not the one that the user is currently using. What am I doing wrong here? 但是,当键盘弹出并且用户触摸(选择)一个单元格时,上面的代码将被调用但不起作用... :(似乎分配的UITableViewCell不是用户当前正在使用的那个。我在这里做错了吗?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.