【问题标题】:UITableView Cell Shows Blank after upgrading into Xcode 7 iOS 9升级到 Xcode 7 iOS 9 后 UITableView 单元格显示空白
【发布时间】:2015-09-20 14:04:58
【问题描述】:

我正在从服务器获取数据,并且能够接收所有数据,但是当我运行项目时它显示空白单元格。当我保留断点时,我了解到代码在VisitorsTableViewCell *cell = (VisitorsTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier]; 之后没有执行。

注意:此代码在 xcode 6.4 中完美运行

- (NSInteger)numberOfSectionsInTableView:(UITableView *)aTableView {
    // Number of sections is the number of regions
    return 1;
}

- (NSInteger)tableView:(UITableView *)aTableView numberOfRowsInSection:(NSInteger)section {
    // Number of rows is the number of time zones in the region for the specified section

    return [VisitorsNameArray count];
}

- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath  {
    static NSString *CellIdentifier = @"VisitorsTableCell";

    VisitorsTableViewCell *cell = (VisitorsTableViewCell *)[tableView dequeueReusableCellWithIdentifier:CellIdentifier];

    cell.visitorName.text = [VisitorsNameArray objectAtIndex:indexPath.row];
    cell.visitorComment.text =  [VisitorsCommentArray objectAtIndex:indexPath.row];
    cell.visitorDate.text =  [VisitorsDateArray objectAtIndex:indexPath.row];
    cell.visitorLocation.text =  [VisitorsLocationArray objectAtIndex:indexPath.row];

    return cell;
}

【问题讨论】:

    标签: ios objective-c uitableview ios9


    【解决方案1】:

    我终于解决了,我不知道 XCode 7 出了什么问题。

    我从 Storyboard 中删除了我的自定义表格单元格并重新开始所有工作,并使用相同的设计重新创建。现在它可以完美运行。

    【讨论】:

    • 重新创建单元格并没有为我解决问题。还有其他想法吗?
    • 是吗?,我刚刚删除并添加了新单元格,这对我来说就是这样,无论如何请检查此链接stackoverflow.com/questions/31899426/…
    猜你喜欢
    • 1970-01-01
    • 2015-11-23
    • 2023-04-11
    • 1970-01-01
    • 2019-10-27
    • 1970-01-01
    • 1970-01-01
    • 2015-10-12
    • 1970-01-01
    相关资源
    最近更新 更多