-tableView:cellForRowAtIndexPath:没有被调用 [英] -tableView:cellForRowAtIndexPath: is not getting called
问题描述
我 UITableView
在 UIViewController
中,我通过outlet和delegete连接并将数据源分配给自己。 numberOfSectionsInTableView
和 numberOfRowsInSection
正在调用我尝试使用 NSLog
但是 cellForRowAtIndexPath
没有接到电话我的代码看起来像
I've UITableView
in UIViewController
and I've connected through outlet and delegete and datasource are assigned to self.numberOfSectionsInTableView
and numberOfRowsInSection
are getting called i tried by using NSLog
but cellForRowAtIndexPath
is not getting call my code looks like
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@" cellForRowAtIndexPath ");
static NSString *CellIdentifier = @"CurrencyCell";
CurrencyCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if (cell == nil) {
cell = [[CurrencyCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:CellIdentifier] ;
}
new *Obj = [appdelegate.array objectAtIndex:indexPath.row];
cell.CurNameLabel.text = Obj.C_Name;
cell.textLabel.text = @"sdfnhsdfndsio;";
NSLog(@"C_Name %@", Obj.C_Name);
return cell;
}
任何一个电话我都会犯错误提前致谢
can any one tel wer i'm making mistake Thanks in advance
推荐答案
似乎 numberOfSectionsInTableView
和 numberOfRowsInSection $返回的c $ c>是0.如果是这种情况,则不会调用cellForRowAtIndexPath ..
It seems the numberOfSectionsInTableView
and numberOfRowsInSection
returned are 0.If this is the case then cellForRowAtIndexPath will not get called..
从上面的注释看来,似乎YourAppDelegate变量是 null
或yourArray null
。尝试在这些代理上保留断点,检查它们返回的值
From the comment above..it seems that "YourAppDelegate" variable is null
or yourArray is null
.Try keeping the break point on these delegates ,to check the values returned by them
这篇关于-tableView:cellForRowAtIndexPath:没有被调用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!