У меня есть UITableViewCell (со связанным подклассом UITableViewCell, .m и .h), созданный в IB, который содержит UITextField. Этот UITextField подключен к IBOutlet в подклассе UITableViewCell и также имеет свойство. В моем контроллере табличного представления я использую эту настраиваемую ячейку со следующим кодом:
// Customize the appearance of table view cells.
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"textfieldTableCell"];
if (cell == nil) {
// Create a temporary UIViewController to instantiate the custom cell.
UIViewController *temporaryController = [[UIViewController alloc] initWithNibName:@"TextfieldTableCell" bundle:nil];
// Grab a pointer to the custom cell.
cell = (TextfieldTableCell *)temporaryController.view;
// Release the temporary UIViewController.
[temporaryController release];
}
return cell;
}
UITextField отображается нормально, и клавиатура выскакивает при нажатии, как и ожидалось, но как мне получить доступ (получить свойство .text) к UITextField, содержащемуся в каждой строке? а также как мне обработать метод textFieldShouldReturn для UITextFields?