ios - 为什么表格 View 不显示 iphone 中的任何数据

标签 ios iphone objective-c uitableview

当解析本地 XML 文件时,我可以使用 NSLog 在控制台中看到数据。在模拟器中,我只获得了没有从 xml 解析的任何数据的普通 TableView 。我不明白我在哪里遗漏了它。

StoryBoard

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath: (NSIndexPath *)indexPath   
{
     static NSString *CellIdentifier = @"Cell";
     UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier: CellIdentifier];     
     if(cell == nil){    
        cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault   reuseIdentifier:CellIdentifier];      

    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;  
    }  

    theLists = [app.listArray objectAtIndex:indexPath.row];
    cell.textLabel.text = theLists.title;  
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}

最佳答案

我认为您没有重新加载表格 View 。 完成解析后,只需重新加载表格 View 即可。

[重新加载表名];

然后检查您的 TableView 委托(delegate)是否在此方法之后调用。 我认为这会对您有所帮助。

快乐编码。

关于ios - 为什么表格 View 不显示 iphone 中的任何数据,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/13491727/

相关文章:

ios - 在 iPad 上的 UIPageViewController 中强制使用纵向模式

ios - 可以自定义IB导航栏中提示字符串的字体吗?

ios - 具有不同字体大小和颜色的 UILabel 文本

ios - 从对象到 json 文本 ios 的转换

ios - NSString 没有得到正确的字符串

iphone - 通过 wifi 在 2 部 iPhone 之间传输文件?

ios - 执行选择器警告 vs dispatch _async

iphone - 创建用于保存数据的唯一字符串

iphone - objective-c : Downloading a PDF file

iphone - Objective-C : Proper way to init an NSArray that is a @property