【发布时间】:2009-10-30 20:08:39
【问题描述】:
我目前在其中一个选项卡上设置了一个带有导航控制器的选项卡栏控制器,然后我为该 Navigationcontrollers 视图设置了一个 UITableView 笔尖。所有这些都是通过 IB 设置的,我希望保持这种状态。有点像本教程http://twilloapp.blogspot.com/2009/05/how-to-embed-navigation-controller.html 现在,当 ViewDidLoad 被调用时,视图可以完美加载。但是当我通过代码 IE 加载更多视图时
MyApp_AppDelegate *delegate = [[UIApplication sharedApplication] delegate];
UINavigationController *nav = (UINavigationController *)delegate.controller.selectedViewController;
newViewController = [[newViewController alloc] initWithNibName:@"newView" bundle:nil];
[nav pushViewController:newViewController animated:YES];
//At this point the view works! and loads
如果我尝试使用导航工具栏返回,它会很好地返回到我之前的视图
现在我需要在返回时刷新 tableview 但调用 viewDidAppear 不起作用。
我尝试将UINavigationDelegate 添加到与tableview 相同的ViewController 类中,然后调用- (void)navigationController:(UINavigationController *)navigationController didShowViewController:
但这没有用。我还尝试添加与标签栏控制器相同的委托,并在那里添加相同的navigationController didShowViewController:,但这也失败了。
如何在每次视图加载时刷新此表?
【问题讨论】:
标签: uinavigationcontroller uitabbarcontroller viewdidappear