有時候咱們須要知道tableview什麼時候刷新結束,來作一些相關的操做,那麼如何得知reloadData結束呢? php
看代碼: html
BOOL _reloadFinished = NO; [tableView reload]; //這裏會自動設置tableView layoutIfNeeded爲YES,意味着將會在runloop結束時重繪tableView,並將重繪任務提交到主隊列 dispatch_async(dispatch_get_main_queue(),^{ _reloadFinished = YES;//因爲mainQueue是串行的,執行到這裏說明上一個提交到mainQueue的task已經完成了(即tableView重繪) });
參考連接: async
http://www.cocoachina.com/bbs/read.php?tid-310407-page-3.html oop
http://stackoverflow.com/questions/16071503/how-to-tell-when-uitableview-has-completed-reloaddata ui