reloadData在UIViewController中不起作用

时间:2015-02-02 21:46:41

标签: ios uitableview

编辑#1 - 我认为这已经解决并正在修复

我有一个UIViewController,在viewDidLoad中调用以下方法,并且没有调用reloadData。我试图把它放回主线程,但它没有崩溃,它只是没有被调用,我不知道为什么:

- (void)viewDidLoad
{

  [super viewDidLoad];

  self.listTV.frame=CGRectMake(0.0f, 0.0f, self.view.frame.size.width, self.view.frame.size.height);

  self.listTV.scrollEnabled=YES;
  self.listTV.delegate=self;
  self.listTV.dataSource=self;
  self.listTV.showsVerticalScrollIndicator = YES;
  [self.listTV setSeparatorStyle:UITableViewCellSeparatorStyleNone];

  [self getEachList:self.listID];
}  


-(void)getEachList:(int) listID
{
  NSLog(@"CALLING GET_EACH_LIST");

  void (^someblock)(id JSON)=^(id JSON){
    NSLog(@"at top of completionBlock within getEachMenu");
    NSLog(@"the json: %@", JSON);
    NSDictionary *tmpResult=[JSON objectForKey:@"list"];
    EMBERSList *list=[[EMBERSList alloc] initWithAttributes:tmpResult];
    self.list=list;
    NSLog(@"count of  self.list.listItems: %i", [self.list.listItems count]);
    //[self.listTV reloadData]; <- this didn't work
    dispatch_async(dispatch_get_main_queue(), ^{ [self.listTV reloadData]; });

  };
  [EMBERSList getCacheAndCallback:listID withHost:EMBERSExtHost() andCallback:someblock];
}

0 个答案:

没有答案