【问题标题】:Move subview after rotated superview iphone?旋转超级视图iphone后移动子视图?
【发布时间】:2012-11-28 00:22:10
【问题描述】:

我有一个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));

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

【问题讨论】:

    标签: iphone uiimageview rotation subview


    【解决方案1】:

    试试这个:

    CGAffineTransformRotate(CGAffineTransform t, CGFloat angle)
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-05-18
      • 1970-01-01
      相关资源
      最近更新 更多