簡體   English   中英

UITableView數據重新加載問題

[英]UITableView data reload issue

Kinda堅持這個問題,不確定如何將數據重新加載到表中。 任何幫助將不勝感激....我已包含以下代碼。

問:在這個新的空白塊中,重新加載表視圖的數據。 表格視圖屬性名為“ 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
          });
      })
 }

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM