Kinda stuck on this question, not sure how to reload the data into the table. Any help would be much appreciated.... I've included the code below.
Q: Inside this new empty block, reload the data for the table view. The table view property is named 'tableView'.
#import "LeaderboardViewController.h"
@implementation LeaderboardViewController
- (void)viewDidLoad {
[super viewDidLoad];
dispatch_queue_t queue= dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) ;
dispatch_async(queue, ^{
self.blogPosts= [BlogLoader getRecentPosts];
dispatch_async(dispatch_get_main_queue(),^{
});
})
}
@end
正是出于这个目的, UITableView
类具有reloadData
方法。
[self.tableView reloadData];
- (void)viewDidLoad {
[super viewDidLoad];
dispatch_queue_t queue= dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) ; dispatch_async(queue, ^{
self.blogPosts= [BlogLoader getRecentPosts];
dispatch_async(dispatch_get_main_queue(),^{
[self.tableView reloadData]; // reloadData will load your table with contents
});
})
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.