我正在使用rss feed.first時間,表視圖沒有rows.if我按下按鈕,會出現values.if我再次按下,表視圖有以前values.after收到它的數據它消失,新的數據會到那裏但是當我按下按鈕時,不能有以前的值。我想
刪除它。我該怎麼辦?任何幫助?如何將UITableviewcell或UITableview設置爲空?
回答
當你需要更新你的UITableView調用[tableView reloadData]
方法的內容。因此,如果到那時您已經清除了您的數據源中的以前的數據,那麼該表必須爲空。
不,我試過了。假設表中有一個url的值。如果點擊 BUTTON,它會傳遞相同的url,那時候沒有更新,previoue的值在那裏...... – 2009-10-21 07:45:39
很難說沒有看到你的代碼......如果以前的值仍然在表中,這意味着你還沒有清除你的數據源 – Vladimir 2009-10-21 08:29:58
UITableView通過數據源工作。我會假設你已經跟着蘋果建立的tableview看起來應該像這樣的方式:
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath;
{
static NSString *identifier = @"identifier";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
if (cell == nil) {
cell = [[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:identifier] autorelease];
}
cell.textLabel.text = [_tableViewData objectAtIndex:[indexPath row]];
return cell;
}
在這個例子中的UITableView中的數據存儲在陣列tableViewData英寸這是初始化,如:
_tableViewData = [[NSArray arrayWithObjects:@"cell 1", @"cell 2", @"cell 3", @"cell 4", nil] retain];
所以,當你想更新的tableview的值,以新的東西,你需要改變tableViewData數組的值,並調用reloadData在表視圖。
_tableViewData = [[NSArray arrayWithObjects:@"new cell 1" , @"new cell 2", @"new cell 3", @"new cell 4", nil] retain];
[_tableView reloadData];
- 1. 在UITableViewCell中爲UITableView設置AutoLayout
- 2. 如何在MSCRM中將查找值設置爲空或爲空?
- 3. 如何將OneToOneField設置爲空/空/空?
- 4. 如何在空UITableViewCell中設置顏色?
- 5. 如何將UIButton標題設置爲空或空字符串
- 6. 設置UITableViewCell和UITableView背景的顏色
- 7. 如何在UITableView中設置UITableViewCell的選定背景顏色
- 8. 如何爲單個UITableViewCell設置動畫?
- 9. 如何爲uitableviewcell設置保證金
- 10. 如何將評分值設置爲空?
- 11. 如何將字典值設置爲空
- 12. 如何將DateTime設置爲空
- 13. 如何將外鍵設置爲空? (symfony)
- 14. 如何將對象設置爲空
- 15. 如何將位列設置爲空?
- 16. 如何將空值設置爲使用JavaScript或jQuery的變量?
- 17. 將exclusiveTouch設置爲自定義UITableViewCell
- 18. 將UITableViewCell高度設置爲UIImage高度?
- 19. 如何手動設置UITableViewCell?
- 20. 在分組的UITableView中爲選定的UITableViewCell設置背景
- 21. 如何將AIRPLANE_MODE_ON設置爲「True」或ON?
- 22. 如何爲UITableView iOS 7設置邊框?
- 23. 如何爲UITableView設置邊框?
- 24. 如何使用commitEditingStyle? (UITableViewCell-UITableView)
- 25. 如何將披露按鈕設置爲UItableViewCell
- 26. UITableViewCell accessoryType設置,但accessoryView爲零。我如何設置accessoryView backgroundColor?
- 27. 如何將自定義單元格設置爲UITableView的頁眉或頁腳
- 28. 如何將UITableViewCell圖像更改爲UITableView中的圓圈
- 29. 將scrollView.delegate設置爲scrollView而不是UITableView
- 30. UITableView將其設置爲無選擇
您提出21個問題,並接受0個。你應該回去接受一些答案。 – 2009-10-21 18:56:43