self.tabBarController dismissViewControllerAnimated doesn't work

前端 未结 1 1940
误落风尘
误落风尘 2021-01-21 18:00

I have a UITabBarController in my application.

I would like to present from one tab, another UIViewController.

So I wrote in ViewControllerA (which

1条回答
  •  不思量自难忘°
    2021-01-21 18:58

    Use the presented viewController's presentingViewController property

    Objective-C

    [self.presentingViewController  dismissViewControllerAnimated:NO completion:nil];
    

    Swift

    presentingViewController?.dismissViewControllerAnimated(false, completion: nil)
    

    You can also use this shorthand version (I don't recommend you do, but you will see it often)

    Objective-C

    [self dismissViewControllerAnimated:NO completion:nil];
    

    Swift

    dismissViewControllerAnimated(false, completion: nil)
    

    see
    Dismissing a Presented View Controller

    0 讨论(0)
提交回复
热议问题