[英]Switching between 2 Views in 2 distinct View Controllers
I have a problem with transitioning between views in different ViewController
s. 我在不同
ViewController
的视图之间转换时遇到问题。
Here is the situation: 情况如下:
My App is a TabBarApplication done with IB which contains a UIViewController
for each Tab. 我的应用程序是使用IB完成的TabBarApplication,其中每个选项卡都包含一个
UIViewController
。 The UIViewController
(PlayerTabViewController) of the first tab contains another UIViewController
(PlayerCreationViewController) to manage a view that will be added as subview. 所述
UIViewController
所述第一接线片(PlayerTabViewController)包含另一个UIViewController
(PlayerCreationViewController)来管理将被添加为子视图的图。
I was able to add the subview using 我能够使用添加子视图
[self.view addSubview:playerCreationViewController.view];
In the PlayerTabViewController. 在PlayerTabViewController中。
The problem is that from the subview I have to return to the parent view and reload it because it contains a tableview that must be refreshed. 问题是从子视图中,我必须返回到父视图并重新加载它,因为它包含必须刷新的表视图。
Using [self.view removeFromSuperview];
使用
[self.view removeFromSuperview];
in the PlayerCreationViewController I can switch back to the parent view, but I'm not able to reload the tableview or do other actions. 在PlayerCreationViewController中,我可以切换回父视图,但是无法重新加载tableview或执行其他操作。 I tried to implement the
-(void)willRemoveSubview:(UIView *)subview
method in PlayerTabViewController but it seems the function is never called. 我试图在
-(void)willRemoveSubview:(UIView *)subview
实现-(void)willRemoveSubview:(UIView *)subview
方法,但似乎从未调用过该函数。
Do you have an Idea of what am I doing wrong? 您是否知道我在做什么错?
you are using wrong method to go on next view. 您使用错误的方法继续查看下一个视图。 just use navigation view controller to switch from one view to another view.
只需使用导航视图控制器即可从一个视图切换到另一视图。
create a object of view 创建一个视图对象
PlayerCreationViewController *playerViewController = [[PlayerCreationViewController alloc] initWithNibName:@"PlayerCreationViewController" bundle:nil];
[self.navigationController pushViewController:playerViewController animated:YES];
[playerViewController release];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.