2010-11-09 53 views
0

如何重新加載TTTableViewController中的數據?我試圖 調用reloadData但它不顯示新的數據。 我已經創建了數據源文件,它是 TTListDataSource的子類。基本上,init函數看起來像這樣。Three20 TTTableViewController重新加載數據

- (id) initWithObject:(NSArray *)objects { 
     if (self = [super init]) { 
       NSMutableArray *priceItems = [[[NSMutableArray alloc] init] autorelease]; 
       for (int i = 0; i < [objects count]; i++) { 
         [priceItems addObject: 
         [PriceItem itemWithName: 
           [[objects objectAtIndex:i] objectAtIndex:0] 
              lastDone:[[objects objectAtIndex:i] objectAtIndex:1] change:[[objects objectAtIndex:i] objectAtIndex:2]]];                       
       } 
       self.items = [NSArray arrayWithArray:priceItems]; 
     } 
     return self; } 

視圖被加載後,我開始流一些數據,從而傳遞到initWithObject的 對象被改變,因此我爲了更新數據呼叫在 子類TTTableViewController的「刷新」,但 數據未更新。它也不適用於刷新方法。我需要在 TTListDataSource的子類中實現其他方法嗎?

+0

你找到了這個問題的答案嗎? – user210504 2011-01-21 17:09:46

回答

3

嘗試

[self invalidateModel]; 

這應該做的伎倆。

1

invalidateModel將重建模型,這是不高效的。

嘗試[TTTableViewController refresh],您的表將被重新加載。

相關問題