0
이 질문은 cellForRowAtIndexPath에 대한 것입니다.cellForRowAtIndexPath : XCode 템플릿이 맞습니까?
나는 올바른 방법이
UITableViewCell* cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithFrame:CGRectZero reuseIdentifier:@"Cell"];
return cell;
알고하지만 마스터 - 상세 템플릿을 만들 때, 코드는 다음과
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"Cell"];
[self configureCell:cell atIndexPath:indexPath];
return cell;
}
- (void)configureCell:(UITableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
NSManagedObject *object = [self.fetchedResultsController objectAtIndexPath:indexPath];
cell.textLabel.text = [[object valueForKey:@"timeStamp"] description];
}
편집처럼 보이는 : 문제는 configureCell atIndexPath에 대해 없습니다. XCode 템플릿에는 이러한 문자열이 없습니다.
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier] ;
XCode 템플릿이 맞습니까?
이것을 확인하면 답변을 얻을 수 있습니다. http://stackoverflow.com/questions/5467831/why-do-programmers-use-configurecellatindexpath-method-to-config-the-tableview – Dhruv