问题
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