UIView透视图 [英] UIView perspective

查看:102
本文介绍了UIView透视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个UIView,我想为其添加透视图.基本上,我得到了其他4个视图,用户可以拖动这些视图来创建透视图.我想指出UIView拐角处的4个点.我调查了一下,发现必须使用CALayer来做到这一点,但是我仍然不清楚如何在iPhone上创建这种转换.任何帮助,指针或示例代码片段都将不胜感激!

I've got an UIView and I want to add perspective to it. Basically I got 4 other views that the user will drag in order to create the perspective. I'd like to indicate 4 points where the UIView's corners will be. I investigated it and I figured out I have to use CALayer to do that, but I'm still no clearer on how to create this kind of transform on an iPhone. Any help, pointers or example code snippets would be really appreciated!

谢谢!

推荐答案

首先查看

Start off by taking a look at the pertinent documentation for CATransform3D. You will create such a transform that describes your perspective and set the CALayer's -transform property to it. (Note that this is distinct from the UIView's -transform which is a CGAffineTransform, not a CATransform3D.)

如果仍然遇到困难,请返回代码. :-)

Come back with code if you still encounter difficulties. :-)

这篇关于UIView透视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆