iphone - - TableView :cellForRowAtIndexPath: is not getting called

标签 iphone uitableview ios5 xcode4

我在 UIViewController 中有 UITableView ,并通过 socket 进行连接,并将委托(delegate)和数据源分配给 self.numberOfSectionsInTableViewnumberOfRowsInSection 正在被调用,我尝试使用 NSLogcellForRowAtIndexPath 没有被调用,我的代码看起来像

- (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;
}

任何人都可以告诉我我犯了错误吗?提前致谢

最佳答案

返回的numberOfSectionsInTableViewnumberOfRowsInSection似乎是0。如果是这种情况,则不会调用cellForRowAtIndexPath。

从上面的评论来看......似乎“YourAppDelegate”变量为null或yourArray为null。尝试在这些委托(delegate)上保留断点,以检查值由他们返回

关于iphone - - TableView :cellForRowAtIndexPath: is not getting called,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12972452/

相关文章:

ios - Thread1v :signal SIGABRT

ios - TableView 行分隔符就像在 iOS7 中的通知中心

iphone - MapKit 添加注释 : not working

ios - fatal error : unexpectedly found nil - number of row

iphone - ios5 上的自动释放替代方案

ios - 为什么 resignFirstResponder 在 iOS 5.0 中被调用两次,而在 iOS4.2-4.3 中只被调用一次?

ios - 如何检查 NSTimer 是否已经失效

iPhone pushViewController同一个类的不同实例

iphone - Xcode 如何将 UITableView Cells 链接到新的 View Controller

swift - UITableView 中灵活可编辑的 UITextView : won’t show the last line under the keyboard