1
我有一個動態tableView
。幾個單元格有一個textField
。UITableView在textFieldDidBeginEditing中獲取indexPath:
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(15,10,260,40)];
textField.delegate = self;
[cell addSubview:textField];
我試圖讓textFieldDidBeginEditing
的indexPath
。這裏是我的代碼
- (void)textFieldDidBeginEditing:(UITextField *)textField
{
CGPoint location = [self.view.superview convertPoint:self.view.center toView:self.orderTableView];
NSIndexPath *indexPath = [self.orderTableView indexPathForRowAtPoint:location];
NSLog (@"IndexPath %@", indexPath);
NSLog (@"IndexPath.ROW %i", indexPath.row);
}
我有第一個4個單元格(索引0 - 3)是標準單元格。在前4個單元之後,我可以動態地使用UITextField將多達3個自定義單元。
的UIViewController中後,會出現與UITableView的,而不管是什麼TableViewCell用的UITextField我點擊的的NSLog下面不斷顯示我下面的:
2013-07-09 07:21:40.910 MyApp[2884:c07] IndexPath <NSIndexPath 0xa0a5d60> 2 indexes [0, 3]
2013-07-09 07:21:40.910 Mypp[2884:c07] IndexPath.ROW 3
我如何才能讓細胞與正確indexPath
UITextField
那叫做鍵盤?
cool :) ..正確答案 –