本文介绍了在显示模态控制器时与演示控制器进行交互的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在展示模型视图控制器时是否可以与展示视图控制器交互?
Is it possible to interact with a presenting view controller whilst a model view controller is being presented?
------------
| |
| VC1 |
| |
| |
| |
| |
|------------|
| VC2 |
| |
------------
在上图中,VC1是presentingViewController
,而VC2是presentedViewController
.我试图实现的用户体验是用户可以与VC1和VC2进行交互.目前,提供VC2时,触摸不会传递到VC1.
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.
推荐答案
我可能迟到了,但是假设您希望VC2处于半屏状态.这使您可以与VC1和VC2进行交互
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
}
}
}
这篇关于在显示模态控制器时与演示控制器进行交互的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!