UITableViewCell 内に UITextField があり、ユーザーが UITextField 内で入力を開始したことを検出したいと考えています。そのため、UITextFields デリゲートを設定しましたが、そのコードを実行すると、「テーブルのファーストレスポンダー ビューを設定していますが、そのタイプ (セル/ヘッダー/フッター) がわかりません」という警告が表示され、UITextField デリゲート メソッドが呼び出されません。 . UITextField メソッドを正しく呼び出すにはどうすればよいですか?
-(void)tableView:(id)view willDisplayCell:(UITableViewCell *)cell forRowAtIndexPath:(NSIndexPath *)indexPath {
if ((indexPath.section == 0) && (indexPath.row == 3)) {
UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(friendCellTapped)];
[tap setNumberOfTapsRequired:1];
[cell addGestureRecognizer:tap];
}
else if ((indexPath.section == 0) && (indexPath.row == 4)) {
NSLog(@"im called");
UITextField *tagBox = [[UITextField alloc] initWithFrame:CGRectMake(50, 6, 225, 25)];
[tagBox setBorderStyle:UITextBorderStyleRoundedRect];
[tagBox setReturnKeyType:UIReturnKeyDone];
tagBox.delegate = self;
[cell addSubview:tagBox];
}
else {
%orig;
}
}