[英]Move subview after rotated superview iphone?
I have a subview
, it is UIImageView
and I have a superview
- uiview. 我有一个
subview
,它是UIImageView
,我有一个超级superview
-uiview。
I add subview to superview. 我将子视图添加到超级视图。 At begin, I move subview using code:
首先,我使用代码移动子视图:
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);
and it move very good!(it move towards a finger-cursor) . 并且它的移动非常好!(它朝着手指光标移动)。
But if i rotate superview, using code: 但是如果我旋转超级视图,使用代码:
superview.transform = CGAffineTransformMakeRotation(degreesToRadians(angle));
at this time, subview does not move correct, not right! 此时,子视图不能正确移动,不正确! (it does not move towards a finger-cursor)?
(它不移向手指光标)?
尝试这个:
CGAffineTransformRotate(CGAffineTransform t, CGFloat angle)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.