私は現在、これを機能させようとしています。どんな助けでも大歓迎です。
私には内なる習慣UITableViewCell
がありUITextField
ます。UITextField
表のセルを選択したら、最初のレスポンダーを作成したいと思います。
ただし 、 false[textField becomeFirstResponder];
を返します。
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [self tableView:tableView cellForRowAtIndexPath:indexPath];
UITextField *textField;
for (UIView *view in [cell subviews]) {
if ([view isMemberOfClass:[UITextField class]]) {
textField = ((UITextField *)view);
}
}
[textField becomeFirstResponder];
}
要求どおり、テキストフィールドの初期化。これはUITableViewCell
サブクラスで行われます。
- (id) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Init Textfield
_textField = [[UITextField alloc] init];
_textField.backgroundColor = [UIColor clearColor];
_textField.delegate = self;
[self addSubview:_textField];
}
return self;
}