`

给UITableViewCell添加UITextField

    博客分类:
  • IOS
 
阅读更多

 

        UITextField *textField = [[UITextField alloc] initWithFrame: CGRectMake(90, 12, 200, 25)];
        textField.clearsOnBeginEditing = NO;//鼠标点上时,不清空
        [textField setDelegate: self];
        textField.returnKeyType = UIReturnKeyDone;
        [textField addTarget:self action:@selector(textfieldDone:) forControlEvents:UIControlEventEditingDidEndOnExit];//把DidEndOnExit事件响应为 textfieldDone: 方法
        [cell.contentView addSubview: textField];

 

- (IBAction)textfieldDone:(id)sender {
    [sender resignFirstResponder];
}
 

 

分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics