0

我已经在屏幕上展示了一个控制器,现在单击主页按钮。然后我需要在使用深度链接点击通知后展示另一个控制器。当应用程序进入前台时,新的控制器也不会出现,之前的控制器也会被解散。也低于警告:-

Attempt to present <NewController> on <PreviousController> whose view is not in the window hierarchy!

我正在使用下面的代码来呈现。

controller.transitioningDelegate = myDelegateForTransition
        controller.modalPresentationStyle = .custom
        controller.modalPresentationCapturesStatusBarAppearance = true
viewControllerFromPresent.present(controller, animated: true, completion: {
            completionHandler?()
        })
4

1 回答 1

0

我通过将 controller.modalPresentationStyle 从 custom 更改为 overCurrentContext 来解决它。

controller.transitioningDelegate = myDelegateForTransition
    controller.modalPresentationStyle = .overCurrentContext
    controller.modalPresentationCapturesStatusBarAppearance = true
viewControllerFromPresent.present(controller, animated: true, completion: {
        completionHandler?()
    })
于 2018-07-31T07:00:13.693 回答