简体   繁体   English

截断清晰的子视图

[英]Clipping behind clear subview

In iOS 8, FaceTime has a UITableView with a UIVisualEffectView behind it blurring the live camera feed. 在iOS 8中,FaceTime的UITableView后面带有UIVisualEffectView,从而模糊了实时摄影机的提要。 When you swipe against a cell, the cell moves to wipe in the Delete button, but it doesn't show fully behind the UITableViewCell. 当您在单元格上滑动时,该单元格将在“删除”按钮中移动以进行擦拭,但不会完全显示在UITableViewCell的后面。

My question is, is there an easy way to replicate this kind of behavior with normal subviews? 我的问题是,有没有一种简单的方法可以用普通子视图复制这种行为? ie have a clear CALayer clip an opaque CALayer with the clear CALayer not showing the subviews of its containing UIView. 即有一个清晰的CALayer剪辑一个不透明的CALayer,其中的清晰的CALayer不会显示其包含UIView的子视图。 I assume what I'm going for is a "Wipe" transition. 我假设我要的是“擦除”过渡。

I'm pretty new to using CALayers and drawRect: and would love some direction in starting. 我对使用CALayers和drawRect很陌生:并希望在开始时有一些指导。

To answer my own question, you have you use a CALayer and store it in the backgroundView's layer.mask property. 要回答我自己的问题,您可以使用CALayer并将其存储在backgroundView的layer.mask属性中。 Then animate the position and bounds of this mask layer and voila. 然后设置此蒙版层和瞧的位置和边界的动画。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM