简体   繁体   English

iOS执行的UINavigationController执行popViewController后被解雇

[英]iOS presented UINavigationController gets dismissed after it performs a popViewController

In my app i present a UINavigationController modally with a UIViewController as its rootViewController . 在我的应用程序中,我以模态形式呈现了一个UINavigationController并将UIViewController作为其rootViewController I do it in form style. 我以表单样式进行操作。 I added a second UIViewController which is also in form style and i can push to it fine. 我添加了第二个同样也是表单样式的UIViewController ,我可以很好地进行介绍。 However when i perform a popViewController action after the second UIViewcontroller gets popped onto the first, the whole modally presented UIViewController gets dismissed. 但是,当我在将第二个UIViewcontroller弹出到第一个popViewController之后执行popViewController动作时,整个模态呈现的UIViewController都会被关闭。 However i don't perform any dismissing and the dismissing function doesn't get triggered by accident either. 但是我不执行任何解除操作,并且解除功能也不会意外触发。

Any ideas why it's happening? 有什么想法为什么会发生吗?

Sincerely, 真诚的

Zoli 佐利

EDIT: 编辑:

That's how i'm presenting the modal viewcontrollers with a navcontroller: 这就是我向模式视图控制器提供navcontroller的方式:

if(!welcomeScreenAlreadyPresented) {

    welcomeScreenViewController = [[WAWelcomeViewController alloc]init];
}

welcomeScreenNavController = [[UINavigationController alloc]initWithRootViewController:welcomeScreenViewController];
[welcomeScreenNavController setModalTransitionStyle: UIModalTransitionStyleCrossDissolve];
[welcomeScreenNavController setModalPresentationStyle:UIModalPresentationFormSheet];
[welcomeScreenNavController setNavigationBarHidden:YES animated:NO];

[self.navigationController presentViewController:welcomeScreenNavController animated:YES completion:nil];

That's how i'm navigation in WAWelcomeViewController.m 这就是我在WAWelcomeViewController.m中导航的方式

registerViewController = [[WARegisterViewController alloc]init];

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

And in WARegisterViewController.m that's how i pop back 在WARegisterViewController.m中,这就是我弹出的方式

[self.navigationController popViewControllerAnimated:YES];

What you need to do is put the viewController you want to push inside another UINavigationController . 您需要做的是将要推送的viewController放入另一个UINavigationController

registerViewController = [[WARegisterViewController alloc]init];
UINavigationController *modalNavigationController = [[UINavigationController alloc] initWithRootViewController:registerViewController]; // autorelease if you are not using ARC

[self presentViewController:navController animated:YES completion:^{}];

You might want to add the modalNavigationController as a property to later call popViewControllerAnimated: on it. 您可能需要将modalNavigationController添加为属性,以便稍后对其调用popViewControllerAnimated:

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 具有呈现的UIAlertController的UINavigationController另外被关闭 - UINavigationController with presented UIAlertController gets additionally dismissed application:didReceiveLocalNotification:执行segue,并在取消segue之后再次调用 - application:didReceiveLocalNotification: performs segue, and gets called again after segue is dismissed iOS /自动版式:取消已演示的控制器后,更改为演示视图 - IOS/Autolayout: Change to Presenting View After Presented Controller Dismissed 在关闭呈现的视图控制器 IOS 后,UINavigationController 行为错误 - UINavigationController behave wrong after dimiss presented viewcontroller IOS 如果我将应用程序移到后台然后在 iOS 中转到前台,则显示的视图控制器将被关闭 - Presented view controller gets dismissed if i move my application to background and then come to foreground in iOS UIMenuController在显示后立即被解雇 - UIMenuController is getting dismissed immediately after being presented 调用popViewController后,UINavigationController的viewControllers的计数将为0 - the count of the UINavigationController's viewControllers will be 0 after you call popViewController 呈现MFMessageComposeViewController然后将其关闭后,呈现视图无法正确显示 - Presenting view not appearing properly after MFMessageComposeViewController is presented and then dismissed 出现后立即将键盘解雇 - Keyboard dismissed as soon as presented 键入一个字符后解雇键盘 - Keyboard gets dismissed after one character is typed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM