我在tableview控制器中使用自定义单元类。
当我在cellForRowAtIndexPath NSLog(@"method called"):
的tableviewcontroller中包含一个语句时,它似乎没有被调用。
当您有自定义单元格时,是否可能不调用此方法?
修改
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"cell for row at index path called");
NSDictionary *item= [self.getItems objectAtIndex:indexPath.row];
//This sets place in storyboard VC
IDTVCell *cell = [self.tableView dequeueReusableCellWithIdentifier:@"Cell"];
cell.item = item;
if (cell == nil) {
cell = [[IDTVCell alloc] initWithStyle:UITableViewCellStyleDefault
reuseIdentifier:@"Cell"];
}
return cell;
}
答案 0 :(得分:0)
cellForRowAtIndexPath。
-tableView:cellForRowAtIndexPath: is not getting called
这就是我的情况。
如果您在错误的线程和某些其他情况下重新加载表,也无法返回。
cellForRowAtIndexPath: not called
但是,自定义单元格本身并不会导致此问题。
答案 1 :(得分:0)
回答你的问题 - 是的,确实如此。
为什么cellForRowAtIndexPath:
没有被调用可能有很多原因。这可能是因为未设置delegate
/ dataSource
或未设置UITableView
帧...等等。
您应该很容易找到一个解决方案,通过更多的在线研究和关闭来查看您的代码。