我有三個ViewControllers:更新UITableView的數據
RootViewController
FirstViewController
SecondViewController
從創建與其他兩個ViewControllers一個TabBarController的RootViewController的。所以我需要這樣做:
FirstViewController *viewController1 = [[FirstViewController alloc] initWithNibName:@"FirstViewController" bundle:nil];
SecondViewController *viewController2 = [[SecondViewController alloc] initWithNibName:@"SecondViewController" bundle:nil];
然後將控制器添加到TabBarController。 在那一刻,我的兩個ViewController被實例化。
要更新我在FirstViewController.m
嘗試這樣的數據:
SecondViewController *test = [[SecondViewController alloc] init];
[test.tableView reloadData];
但什麼也沒有發生,我想是因爲我SecondViewController之前已被分配,並且正在創建它的一個新的實例。
如何從我的FirstViewController更新SecondViewController中的Table的數據?
我當tryn到添加到SecondViewController.h錯誤(它說,委託不存在):S –
沒有你'#進口「FirstViewController。h「' –