我有三个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“' –