应用CATransform3D后近似矩形吗? [英] Approximate rect after applying CATransform3D?

查看:76
本文介绍了应用CATransform3D后近似矩形吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我将 CATransform3D 应用于视图。

我的意思是我应用了一个复杂的变换:旋转,平移,缩放和透视。我需要找到近似最小矩形。我需要它,因为此视图已添加到 UIScrollView (要知道我需要的 contentSize ,当然也要实现 scrollToItem :)

I mean I applied a complex transform: rotation, translation, scale and perspective. And I need to find something like approximate minimal rect. I need it because this view is added to UIScrollView (to know the contentSize I need and of course to implement "scrollToItem:")

推荐答案

如果您想完全获得 CGRect 包含此转换后的视图,可以使用 convertRect:toView:。例如:

If you want to get the CGRect that completely contains this transformed view, you can use convertRect:toView:. For example:

CGRect rect = [viewWithTransforms convertRect:viewWithTransforms.bounds toView:self.view];

例如,灰色视图是某些转换后的 UIView ,黑色边框是 convertRect:toView:的结果,如上所示:

For example, the gray view is some transformed UIView, and the black border is the result of convertRect:toView: shown above:

这篇关于应用CATransform3D后近似矩形吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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