2011-04-09 56 views
1

我有一個視圖,我想顯示一個UITableView和動畫添加行。在我的.m中,我將它設置爲具有UITableView子類的UIViewController。我有我的數據源和委託與我的文件的所有者鏈接。用動畫插入UITableView?

因爲當試圖調用這樣的東西不會工作:[self.tableView reloadData]',我創建了一個UITableView IBOutlet來做到這一點 - theTableView

當試圖調用添加對象是這樣的:

NSArray *insertIndexPaths = [[NSArray alloc] initWithObjects: 
          [NSIndexPath indexPathForRow:0 inSection:0], 
          [NSIndexPath indexPathForRow:1 inSection:0], 
          [NSIndexPath indexPathForRow:2 inSection:0], 
          nil]; 
[theTableView beginUpdates]; 
[theTableView insertRowsAtIndexPaths:insertIndexPaths withRowAnimation:UITableViewRowAnimationFade]; 
[theTableView endUpdates]; 

它啓動,但viewDidLoad中被調用時沒有任何反應。我不能讓它成爲一個UITableViewController,因爲我有許多其他項目。

對不起,如果我的行話聽起來有點不對 - 我是一個noobie在這。任何幫助表示讚賞!

庫爾頓

+0

你如何將UITableView添加到你的視圖? – 2011-04-09 21:15:00

+0

我使用NSMutableArray填充它。 – iosfreak 2011-04-09 21:39:55

回答

2

我猜你有一個連接中斷在Interface Builder您的UITableView出口。

+0

不,它已連接。 – iosfreak 2011-04-09 22:28:38

+0

你正在綜合這個屬性並調用self.theTableView對嗎? – 2011-04-09 22:33:00

+0

現在有效!非常感謝 :) – iosfreak 2011-04-09 23:01:26