【问题标题】:UITableView reloadData with performSelectorInBackgroundUITableView reloadData 与 performSelectorInBackground
【发布时间】:2013-08-02 08:59:33
【问题描述】:

App 界面在屏幕顶部有一个 UISegmentedControl,在屏幕其余部分有一个 UITableView。

当 UiSegmentedControl 获得点击时,NSFetchedController 会获得更新 NSFetchRequest 的 NSPredicate 并执行 performFetch 方法。

因为,需要 4 秒才能得到结果我想重新加载一个 tableview 以显示 0 个部分,然后在结果准备好后重新加载一个 tableView。

怎么做?

【问题讨论】:

    标签: objective-c uitableview reloaddata


    【解决方案1】:
    - (void)viewDidLoad
    {
        [super viewDidLoad];
    
        [self performSelectorInBackground:@selector(exercisedata) withObject:nil];
    
    }
    
    
    -(void)exercisedata
    {
        [self performSelectorOnMainThread:@selector(ProcessComplete) withObject:nil waitUntilDone:NO];
    }
    -(void)ProcessComplete
    {
        [tbl reloadData];
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-02-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-08-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多