拥有2个或更多UINavigationControllers是不对的

时间:2015-06-21 06:49:29

标签: ios iphone uiviewcontroller uinavigationcontroller uitabbarcontroller

我有一些使用我的开始导航控制器的身份验证视图控制器,就像在AppDelegate.m中一样:

@property (strong, nonatomic, retain) BeginViewController *beginViewController;
@property (strong, nonatomic, retain) BeginNavigationController *beginNavigationController;

...

_beginViewController = [[BeginViewController alloc] init];
_beginNavigationController = [[BeginNavigationController alloc] initWithRootViewController:_beginViewController];
self.window.rootViewController = _beginNavigationController;
[self.window makeKeyAndVisible];

在某一点之后,用户将自行进行自我更新,如果没有错误,则会发生这种情况:

ATabBarController *tab = [[ATabBarController alloc] init];

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

然后是标签栏控制器init:

@property (nonatomic, strong, retain) InsideNavigationController *nav1;
....
@property (nonatomic, strong, retain) InsideNavigationController *nav4;

_view1 = [[AViewController alloc] init];
...
_view2 = [[DViewController alloc] init];

_nav1 = [[InsideNavigationController alloc]initWithRootViewController:_view1];
...
_nav4 = [[InsideNavigationController alloc]initWithRootViewController:_view4];

这是正确的做事方式吗?我希望有一个导航控制器处理身份验证和所有未经身份验证的视图,然后在进行身份验证后使用标签栏的导航控制器。

如何返回第一个视图控制器?

感谢。

0 个答案:

没有答案