У меня есть 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?