I applied CATransform3D
to a view. How can I find its approximate new frame after it?
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:")
答案 0 :(得分:1)
如果您希望获得完全包含此转换后视图的CGRect
,则可以使用convertRect:toView:
。例如:
CGRect rect = [viewWithTransforms convertRect:viewWithTransforms.bounds toView:self.view];
例如,灰色视图是一些变换后的UIView
,黑色边框是上面显示的convertRect:toView:
的结果: