stackOverflow上有很多相同的问题。 但我无法解决这个问题。
如何在UITableView中成为FirstResponder UITextField? 我想像下面这样做。 按下编辑按钮,然后将焦点放在UITableView中的UITextField上。
-(void)setEditing:(BOOL)editing animated:(BOOL)animated{
if (editing) {
for ( int i = 0 ; i < items.count ; ++ i ) {
UITextField * ii = [textFields_ objectAtIndex:i];
if ([textFields_ objectAtIndex:i] == [NSNull null]) {
}
[ii setUserInteractionEnabled:YES];
if (ii.tag == 0) {
[ii becomeFirstResponder];
}
}
}
答案 0 :(得分:0)
-(void)setEditing:(BOOL)editing animated:(BOOL)animated{
[super setEditing:editing animated:YES];
if (editing) {
for ( int i = 0 ; i < items.count ; ++ i ) {
UITextField * ii = [textFields_ objectAtIndex:i];
[ii setUserInteractionEnabled:YES];
if (ii.tag == 0) {
[ii becomeFirstResponder];
}
}
}
}