我在tableview控制器中使用自定義單元類。當您使用自定義單元格時調用cellForRowAtIndexPath?
當我在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;
}
用你實際的'cellForRowAtIndexPath'方法更新你的問題。還要確保您的數據源方法返回非零數量的行。 – rmaddy
然而,numberofrowsinsection方法返回許多指定的值,即返回1返回1.但是,cellforrowatindexpath似乎沒有被調用。 – user1904273
如果在該部分中有非零的部分和非零行,則應該調用'cellForRow ...'方法。你是否證實'numberOfRowsInSection:'被調用? – rmaddy