0

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];
        }
    }
}
4

1 回答 1

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];
            }
        }
    }
}
于 2013-01-03T07:04:51.493 回答