2013-01-18 39 views
0

工作我使用*的NSMutableDictionary articleDictionary作爲tableview.I數據源有不同的選項卡中的tableview頁,每個標籤我使用不同的XML文件[https://開頭的域。 com/api/categories/3/user/xml]。我在(void)viewDidUnload區域收到了不同的值集合,但在表格視圖中沒有反映出來.Tableview仍然顯示舊的值。請幫助我。謝謝的NSMutableDictionary更新不UITableView的

self.articleDictionary = [NSDictionary dictionaryWithContentsOfURL: [NSURL URLWithString:urlString]]; 
+0

您是否嘗試過* [_ myTableView reloadData] *如果您手動創建了表視圖,或者* [self.tableView reloadData] *如果您在UITableViewController中? – rdurand

+0

我試過但沒有工作 – Suppry

+0

我正在使用[self.myTableView reloadData]; in - (void)viewDidAppear:(BOOL)animated { – Suppry

回答

0

我解決了這個問題。 我將我的UiviewController超類更改爲UITableViewController。感謝您的幫助。

0

請致電[self.tableView reloadData];

+0

我試過但沒有工作 – Suppry

0

你必須告訴tableview更新。該tableview不能猜到你的價值已經被更新;)

類似的東西應該幫助表格視圖

// Update your files normally... 
// ... 
// Trigger the reload 
[self.tableView reloadData]; 
+0

我試過但沒有工作 – Suppry

1

嘗試觸發重載,當你與解析完成。這是從更新你的NSMutableDictionary的相同方法重新加載表。

0

你可以把充足的調試東西放到你的表視圖控制器類中。 這裏有一些指針:

  • 當你調用reloaddata,你觀察到了多少次的tableView:的cellForRowAtIndexPath被調用?你有沒有得到適當的指數值?

  • 你是否更新過你的tableView:numberOfRowsInSection:爲了反映數據源的變化?即最新的NSMutableDictionary計數?

  • 在你的tableView:cellForRowAtIndexPath中,把NSLog關於NSMutableDictionary看看它是否反映了最新狀態?