繁体   English   中英

旋转超级视图iPhone后移动子视图?

[英]Move subview after rotated superview iphone?

我有一个subview ,它是UIImageView ,我有一个超级superview -uiview。

我将子视图添加到超级视图。 首先,我使用代码移动子视图:

float difx = [[touches anyObject] locationInView:subview].x - [[touches anyObject] previousLocationInView:subview].x;

float dify = [[touches anyObject] locationInView:subview].y - [[touches anyObject] previousLocationInView:subview].y;

subview.transform = CGAffineTransformTranslate(subview.transform, difx, dify);

并且它的移动非常好!(它朝着手指光标移动)。

但是如果我旋转超级视图,使用代码:

superview.transform = CGAffineTransformMakeRotation(degreesToRadians(angle));

此时,子视图不能正确移动,不正确! (它不移向手指光标)?

尝试这个:

CGAffineTransformRotate(CGAffineTransform t, CGFloat angle)

暂无
暂无

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

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