2010-11-17 82 views
0

我在不同ViewController s之间转换视图之间存在问题。在2个不同视图控制器中的2个视图之间切换

这里的情况是:

我的应用程序与IB做了TabBarApplication其中包含每个标签有UIViewController。第一个选项卡的UIViewController(PlayerTabViewController)包含另一个UIViewController(PlayerCreationViewController)来管理将作为子视图添加的视图。

我能够添加使用

[self.view addSubview:playerCreationViewController.view];

在PlayerTabViewController子视图。

问题是,从子视图我必须返回到父视图并重新加载它,因为它包含必须刷新的表视图。

在PlayerCreationViewController中使用[self.view removeFromSuperview];我可以切换回父视图,但我无法重新加载tableview或执行其他操作。 我试图在PlayerTabViewController中实现-(void)willRemoveSubview:(UIView *)subview方法,但它似乎从未调用函数。

你有什么想法我做错了吗?

回答

0

您正在使用错误的方法继续下一个视图。只需使用导航视图控制器从一个视图切换到另一个视图。

创建的视对象

PlayerCreationViewController *playerViewController = [[PlayerCreationViewController alloc] initWithNibName:@"PlayerCreationViewController" bundle:nil]; 

[self.navigationController pushViewController:playerViewController animated:YES]; 

[playerViewController release]; 
相关问题