【发布时间】:2010-12-25 20:38:13
【问题描述】:
我有一个 UIView,我希望用户能够在屏幕上拖动。
-(void)touchesMoved:(NSSet*)touches withEvent:(UIEvent*)event
{
CGPoint pt = [[touches anyObject] locationInView:self];
CGPoint center = self.center;
CGFloat adjustmentX = pt.x - startLocation.x;
CGFloat adjustmentY = pt.y - startLocation.y;
center.x += adjustmentX;
center.y += adjustmentY;
[self setCenter:center];
}
在我对视图应用如下变换之前完美运行:
self.transform = CGAffineTransformMakeRotation(....);
但是,一旦应用了变换,拖动 UIView 会导致视图以指数螺旋效果移动。
我假设我必须对 touchesMoved 方法中的旋转进行更正,但到目前为止,我没有尝试过所有尝试。
【问题讨论】:
-
嗨@Dave你找到解决方案了吗?
标签: iphone uiview touchesmoved