Interact with presenting controller whilst a modal controller is displayed

橙三吉。 提交于 2020-01-15 01:46:06

问题


Is it possible to interact with a presenting view controller whilst a model view controller is being presented?

 ------------
|            |
|    VC1     |
|            |
|            |
|            |
|            |
|------------|
|    VC2     |
|            |
 ------------

In the illustration above VC1 is the presentingViewController and VC2 is the presentedViewController. The user experience I am trying to achieve is that the user can interact with VC1 and VC2. At the moment, touches are not passed through to VC1 when VC2 is presented.


回答1:


I might be late to this but assuming you want your VC2 to be half screen. This allows you to interact with both VC1 and VC2

class CustomListPlacesTableViewController: UIPresentationController {
    override var frameOfPresentedViewInContainerView: CGRect {
        get {
            containerView?.frame.origin.y = UIScreen.main.bounds.midY
            containerView?.backgroundColor = .black
            return super.frameOfPresentedViewInContainerView
        }
    }
}


来源:https://stackoverflow.com/questions/37051839/interact-with-presenting-controller-whilst-a-modal-controller-is-displayed

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!