在我第一次加載時,所有的工作都很好。這是我的NSLogviewDid在第二次嘗試時出現在CellForRowAtIndex後加載
2013-03-07 09:15:57.289 SAMPLE[10566:207] -->Starting viewDidLoad
2013-03-07 09:15:57.775 SAMPLE[10566:207] -->Starting viewDidAppear
2013-03-07 09:15:58.518 SAMPLE[10566:207] all done!
2013-03-07 09:15:58.518 SAMPLE[10566:207] stories array has 4 items
2013-03-07 09:15:58.527 SAMPLE[10566:207] -->Starting CellForRowAtIndex
但是,當我在導航點擊返回按鈕,然後單擊視圖中再次它掛直至細胞填充。見下面的NSlog
2013-03-07 09:16:06.252 SAMPLE[10566:207] -->Starting viewDidLoad
2013-03-07 09:16:06.309 SAMPLE[10566:207] -->Starting CellForRowAtIndex
2013-03-07 09:16:07.019 SAMPLE[10566:207] -->Starting CellForRowAtIndex
2013-03-07 09:16:07.679 SAMPLE[10566:207] -->Starting CellForRowAtIndex
2013-03-07 09:16:08.198 SAMPLE[10566:207] -->Starting CellForRowAtIndex
2013-03-07 09:16:09.242 SAMPLE[10566:207] -->Starting viewDidAppear
我的viewDidAppear在這裏有以下內容。
- (void)viewDidAppear:(BOOL)animated {
NSLog(@"-->Starting viewDidAppear");
[super viewDidAppear:animated];
if ([[xmlParser branch] count] == 0) {
[self loadDatafromServer]; // Goes and runs my XML Parser and fill the array.
}
[self loadBranchs]; // This just loads my annotations for my map
[self.tableView reloadData];
}
這裏的任何想法。正如我所說,她第一次加載完美,但如果用戶回來並進入它填充細胞首先造成延遲。我希望它打開視圖然後填充。該指標將顯示他們然後加載。
我猜你需要到位viewDidAppear來實現viewWillAppear中。 – 2013-03-07 07:26:59
你是否也在viewDidLoad中調用[self.tableView reloadData]? – 2013-03-07 07:27:53
@GopeshGupta是的,同樣的問題。 – Cliffordwh 2013-03-07 07:29:45