我有一个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];
}