我有一个包含UITextField的IB创建的UITableViewCell(带有关联的UITableViewCell子类,.m & .h)。此UITextField连接到UITableViewCell子类中的IBOutlet,并且还有一个属性。在我的表视图控制器我使用这个自定义单元格用下面的代码:在自定义UITableViewCell中访问UITextField
// 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每行包含?以及如何处理UITextFields的'textFieldShouldReturn'方法?
干杯Rog,我会尝试一下,当我回到我的苹果。我想知道Apple如何做到这一点,比如设置应用程序,我以为我会比这更简单/更清洁。我想他们可能会用完全不同的方式来做,而且都用代码。 – Darthtong 2010-12-07 12:18:41