Iphone configureCall中没有返回值:atIndexPath:?
我对传入configureCall:atIndexPath:的cell对象发生了什么感到有点困惑,我可以看到发生了什么,但很奇怪configureCall:atIndexPath:没有将UITableViewCell作为返回值返回Iphone configureCall中没有返回值:atIndexPath:?,iphone,objective-c,cocoa-touch,Iphone,Objective C,Cocoa Touch,我对传入configureCall:atIndexPath:的cell对象发生了什么感到有点困惑,我可以看到发生了什么,但很奇怪configureCall:atIndexPath:没有将UITableViewCell作为返回值返回 - (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath { static NSString *cellID =
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
static NSString *cellID = @"PLANETCELL_ID";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
if(cell == nil) ...
// POPULATE CELL NEW
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath {
Planet *managedPlanet = [[self fetchedResultsController] objectAtIndexPath:indexPath];
[[cell textLabel] setText:[managedPlanet name]];
[[cell detailTextLabel] setText:[managedPlanet type]];
}
它不需要返回对象,传入的
单元格
对象正在原地修改。通过这种方式,configureCell
方法不需要以任何方式分配或管理对象,它只需要对调用方已经提供的传入单元格执行所需的操作谢谢Dan,我只是好奇而已。