2012-12-10 78 views
0

我有一個subview,它是UIImageView,我有一個superview - uiview。旋轉superview iphone後移動子視圖?

我將子視圖添加到超級視圖。開始時,我使用代碼移動子視圖:

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));

在這個時候,子視圖不動正確的,不正確的! (它不會移向手指)?

回答

0

試試這個:

CGAffineTransformRotate(CGAffineTransform t, CGFloat angle)