首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >TableViewCell显示缓慢

TableViewCell显示缓慢
EN

Stack Overflow用户
提问于 2013-01-24 09:07:05
回答 1查看 45关注 0票数 0

我使用另一个视图控制器为我的表视图创建了一个自定义单元格,以便向其中添加内容。但奇怪的是,内容显示得很慢。我的意思是大多数时候只有中心线出现(有时什么也没有出现),然后玩单元格,一段时间后,其余的内容(总共3行)最终出现。

一段时间后,

一切都在这里。

代码语言:javascript
复制
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    eatEventTableViewCell *cell = (eatEventTableViewCell*)[tableView dequeueReusableCellWithIdentifier:@"expenseCell"];
    if (cell == nil) {
    cell = [[eatEventTableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"expenseCell"];
    }

    [self configureCell:cell atIndexPath:indexPath];
    return cell;
}

- (void)configureCell:(eatEventTableViewCell *)cell atIndexPath:(NSIndexPath *)indexPath
{
    NSManagedObject *object = [self.fetchedResultsController objectAtIndexPath:indexPath];

    cell.nameField.text = [[object valueForKey:@"descText"] description];
    cell.tagsField.text = [[object valueForKey:@"type"] description];
    cell.creationDateLabel.text = [eatAddViewController dateFormat:[[object valueForKey:@"timeStamp"] description] :TRUE];
    if([eatExpenseType getSelectionValue :cell.tagsField.text :m_setting])
    {
        cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    }
    else
    {
        cell.accessoryType = UITableViewCellAccessoryDetailDisclosureButton;
    }
}
EN

回答 1

Stack Overflow用户

发布于 2013-01-24 09:13:57

  • 由于您是从核心数据中获取数据,一种可能性是获取过程需要很长时间。你正在处理一个很大的database
  • Another吗?可能的解释是,你正在主线程上执行一些其他的CPU密集型任务。每个UI操作都发生在主线程上,如果主线程也忙于其他任务,您可能会在显示中遇到延迟。然后,您可能希望在后台线程上执行这些其他任务。
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/14492252

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档