【发布时间】:2014-08-23 19:03:57
【问题描述】:
我有一个为 iOS 5 构建的应用程序,我正在尝试直接升级到 iOS 7,所以这也可能是 iOS 6 的问题。
我们在自定义表格视图单元格(派生自 UITableCellView 的类)中有一个 UITextField,但点击它不再会在模拟器中调出键盘。一切都已启用,并且选中了 User Interaction Enabled。
它曾经在 iOS 5 中运行良好。
我不确定要包含哪些代码,但这里是创建单元格的代码... LoginRegisterTableViewCell 仅有一个“fieldLabel”(UILabel)和“userText”(UITextField):
// Login area
static NSString * reuseIdentifier = @"LoginRegisterTableViewCell";
LoginRegisterTableViewCell * cell = (LoginRegisterTableViewCell *)[tableView dequeueReusableCellWithIdentifier:reuseIdentifier];
if(cell == nil)
{
// The official Apple way of loading TableViewCell nibs
// http://www.nomadplanet.fr/2011/01/custom-uitableviewcells-loaded-from-xib-howto-debug/
[[NSBundle mainBundle] loadNibNamed:@"LoginRegisterTableViewCell" owner:self options:nil];
cell = formFieldCell;
self.formFieldCell = nil;
}
cell.delegate = self;
cell.userText.tag = [indexPath row];
如果我在选择表格单元格时调用 [userText becomeFirstResponder],我可以启动键盘,但这似乎是一种解决方法,而不是正确的方法。
【问题讨论】:
标签: uitableview ios7 keyboard uitextfield