-tableView:cellForRowAtIndexPath:没有被调用 [英] -tableView:cellForRowAtIndexPath: is not getting called

查看:122
本文介绍了-tableView:cellForRowAtIndexPath:没有被调用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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 NSLogbut 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 是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屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆