Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/iphone/35.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone configureCall中没有返回值:atIndexPath:?_Iphone_Objective C_Cocoa Touch - Fatal编程技术网

Iphone configureCall中没有返回值:atIndexPath:?

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 =

我对传入configureCall:atIndexPath:的cell对象发生了什么感到有点困惑,我可以看到发生了什么,但很奇怪configureCall:atIndexPath:没有将UITableViewCell作为返回值返回

- (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,我只是好奇而已。