简体   繁体   English

在关闭ViewController后,PushViewController不进行推送

[英]PushViewController doesn't pushes after dismissingViewController

I am developing iPhone app, where i got stuck at one point. 我正在开发iPhone应用程序,我一度陷入困境。

The error i am facing is, i have one presentViewController on which i have one button, on click of that button i am dismissing my presentViewController and after dismissing i want to push My view controller but it doesn't pushes. 我面临的错误是,我有一个presentViewController ,上面有一个按钮,单击该按钮时,我解散了presentViewController ,解散后我想推送“我的视图控制器”,但没有推送。

Code on PresentViewController: PresentViewController上的代码:

- (IBAction)ButtonClick:(id)sender {

    [self dismissViewControllerAnimated:YES completion:^{
        [Obj MethodCall];
    }];

} 

after dismissing PreviousViewController : 解雇PreviousViewController

-(void) MethodCall
 {
    NSLog(@" -- MethodCall Success --");
    [self.navigationController pushViewController:[[NewViewController alloc] init] animated:YES];
 }

My log shows -- MethodCall Success -- but it does not pushes my view. 我的日志显示-- MethodCall Success --但不会推送我的视图。

Where i am doing mistake ? 我在哪里做错了?

Please help and thanks for reading. 请帮助并感谢您的阅读。

The problem with you is I think you are not having UINavigationController as a rootViewController of the viewController from which you have to navigate. 您遇到的问题是,我认为您没有将UINavigationController作为必须从中导航的viewController的rootViewController。 So please try to add a UINavigationController as a parent view or rootView of the vieController from which you want to push another viewController. 因此,请尝试将UINavigationController添加为要从中推入另一个viewController的vieController的父视图或rootView。

 - (IBAction)ButtonClick:(id)sender {
    NewViewController *newView = [[NewViewController alloc] init]
       [self presentViewController:newView animated:YES completion:nil];
    } 

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM