我在我的主視圖(這是一個Web瀏覽器)中的彈出窗口中有一個tableview。每當用戶訪問一個網頁時,我都希望它將網頁添加到最近訪問過的網站列表中。我將代碼設置爲將URL作爲字符串添加到作爲表視圖的數據源的數組中。表格視圖僅顯示訪問的第一個網站,並且不會顯示任何過去的內容。但是我知道這些站點正在被添加到數組中,因爲數組在添加後顯示了使用NSLog語句的站點。但是他們仍然不會出現在桌子上。誰能幫我?將對象添加到數組後,tableview將不會更新
編輯:
- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
// Return the number of sections.
return 1;
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
// Return the number of rows in the section.
return [recentlyVisitedUrls count];
}
你在調用'[tableView reloadData]'? – 2012-01-13 21:12:46
是的,但它刪除了之前有過的數據 – Slayter 2012-01-13 22:06:26