How do I apply a perspective transform to a UIView?

前端 未结 3 2049
萌比男神i
萌比男神i 2020-11-22 03:48

I\'m looking to perform a perspective transform on a UIView (such as seen in coverflow)

Does anyonew know if this is possible?

I\'ve investigated using

3条回答
  •  清酒与你
    2020-11-22 04:29

    You can only use Core Graphics (Quartz, 2D only) transforms directly applied to a UIView's transform property. To get the effects in coverflow, you'll have to use CATransform3D, which are applied in 3-D space, and so can give you the perspective view you want. You can only apply CATransform3Ds to layers, not views, so you're going to have to switch to layers for this.

    Check out the "CovertFlow" sample that comes with Xcode. It's mac-only (ie not for iPhone), but a lot of the concepts transfer well.

提交回复
热议问题