Listview UITextField becomeFirstResponder不工作
我在屏幕底部有一个列表视图,在屏幕顶部有一个4字段的输入表单。当我点击列表项时,我想将焦点设置为第一个文本字段 我有这样的代码:Listview UITextField becomeFirstResponder不工作,listview,uitextfield,becomefirstresponder,Listview,Uitextfield,Becomefirstresponder,我在屏幕底部有一个列表视图,在屏幕顶部有一个4字段的输入表单。当我点击列表项时,我想将焦点设置为第一个文本字段 我有这样的代码: - (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath { .... .... else if(edit
- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
....
....
else if(editingStyle == UITableViewCellEditingStyleInsert)
{
[self clrscreen];
[oDescription becomeFirstResponder];
}
但它不起作用。我必须先把焦点从列表视图中取出来吗?或者在
[self clrscreen];
方法处理UI,并重新绘制UITableView。如果是这样的话,在你打电话给
[oDescription becomeFirstResponder];
它不在那里。请检查oDescription
是否不是nil
还有一件事:在哪里/什么时候叫它:
....
....
else if(editingStyle == UITableViewCellEditingStyleInsert) ?
CLR屏幕一定是问题所在,我将其删除,现在一切正常。此外,我还添加了上面提到的方法的标题。谢谢你的帮助!