IOS 页面跳转问题:点击按钮页面不跳转

问题:每次运行模拟器进入(登录页面->我的页面->注销)没有问题,但是注销后回到登录页面,再点击登录就没有反应了。

AppDelegate:

LoginViewController *loginViewController = [[LoginViewController alloc]init];
if ([loginViewController isKindOfClass:[LoginViewController class]]) {
     _navigationController = [[UINavigationController alloc] initWithRootViewController:loginViewController];
}

self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor =  [UIColor whiteColor];
self.window.rootViewController = _navigationController;
[self.window makeKeyAndVisible];

我的页面中的注销:
LoginViewController *logView = [[LoginViewController alloc]init];
AppDelegate *myDelegate = [[UIApplication sharedApplication] delegate];
myDelegate.window.rootViewController = logView;

点击按钮进入PreGWController 再登录:
代码点击后没反应:
if (_pregw==nil) {
_pregw = [[PreGWController alloc]initWithNibName:nil bundle:nil];
}
AppDelegate *myDelegate = [[UIApplication sharedApplication] delegate];
[myDelegate.navigationController pushViewController:_pregw animated:YES];

code改为:跳转正常了

if (_pregw==nil) {
    _pregw = [[PreGWController alloc]initWithNibName:nil bundle:nil];
 }//创建根试图控制器
UINavigationController* navi = [[UINavigationController alloc ] init];//创建导航控制器
AppDelegate *myDelegate = [[UIApplication sharedApplication] delegate];
[navi pushViewController:_pregw animated:YES];//入栈

myDelegate.window.rootViewController = navi;//
[myDelegate.window makeKeyAndVisible];

参考:http://www.cnblogs.com/496668219long/p/4472195.html

你可能感兴趣的:(IOS)