简体   繁体   English

使用CAShapeLayer遮罩呈现的视图控制器,也遮罩呈现的视图控制器

[英]masking presented view controller with CAShapeLayer also mask the presenting view controller

like the titles says, i have a first view controller (VC1) that presents a second one (VC2) modaly. 如标题所述,我有一个第一视图控制器(VC1),它提供了第二个视图控制器(VC2)模态。 on VC2 i apply a resizable mask on self.view.layer.mask that changes its size with a pan gesture, but when the mask resizes i don't see VC1 behind VC2, i see just black color which is the .backgroundColor of the application's UIWindow . 在VC2我申请一个可调整大小的面膜self.view.layer.mask与平移手势改变其大小,但在口罩大小调整我没有看到背后VC2 VC1,我看到的只是黑色这是.backgroundColor的应用程序的UIWindow both self.view.clipToBounds and self.view.layer.masksToBounds are set to true on self.view of VC2. 在VC2的self.viewself.view.clipToBoundsself.view.layer.masksToBounds都设置为true why is that? 这是为什么? thanks 谢谢

video of bug: https://youtu.be/9Kda10Sl2g8 错误的视频: https : //youtu.be/9Kda10Sl2g8

i managed to go around it as @nguyenbao95 suggested in his comment: Add another UIView to VC2's self.view (this view is above the snapshot), then add all your content to this view. 我按照@ nguyenbao95在他的评论中的建议设法解决了这个问题:在VC2的self.view中添加另一个UIView(此视图在快照上方),然后将所有内容添加到该视图。 And mask this view. 并掩盖此视图。

i suspect that when i modaly present VC2 then VC1 is no longer visible behind VC2 until it is needed again. 我怀疑当我模态显示VC2时,VC1在VC2后面不再可见,直到再次需要它为止。

Before you present the second VC, just take screenshot of the first VC. 在呈现第二个VC之前,只需获取第一个VC的屏幕截图。 And then add an UIImageView with this image to the second VC. 然后将带有该图像的UIImageView添加到第二个VC。

Hope it will solves your problem 希望它能解决您的问题

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何暂时隐藏同时呈现视图控制器的呈现视图控制器 - How to temporarily hide a presented View controller that is also presenting a view controller 呈现视图 controller 也可以是呈现视图 controller 吗? - Can a presented view controller also be a presenting view controller? 如何在呈现的View Controller和呈现的View Controller之间建立关系? - How to setup a relationship between the presenting View Controller and the presented View Controller? 旋转呈现的视图并锁定呈现视图控制器的方向 - Rotate presented view and lock the orientation of presenting view controller 为什么模式视图(由详细视图控制器呈现)呈现视图控制器是拆分视图控制器? - Why modal view's (presented by detail view controller) presenting view controller is split view controller? 解除 UIImagePickerController 也解除呈现视图控制器 - Dismissing of UIImagePickerController dismisses presenting view controller also 关闭presentedViewController也会关闭呈现视图controller - Dismissing presentedViewController also close the presenting view controller 调用viewWillAppear时显示视图控制器的问题被解除 - Issue with calling viewWillAppear of presenting view controller when presented one is dismissed 消除演示的VC时,Presenting View Controller失去子视图 - Presenting View Controller loses subviews when dismissing presented VC iOS /自动版式:取消已演示的控制器后,更改为演示视图 - IOS/Autolayout: Change to Presenting View After Presented Controller Dismissed
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM