【发布时间】:2011-10-18 13:19:54
【问题描述】:
在touchesBegin、touchesMoved和touchesEnded方法中,我设置了图像视图的中心:
[myImageView setCenter:CGPointMake(location.x, location.y)];
问题在于快速手指手势和图像更改位置之间存在延迟。我希望图像立即跟随手指的位置而没有任何延迟。
我什至尝试跳过微小的位置更改,以使图像的位置与手指的位置保持同步,但这并没有太大帮助。
int diff1=(location.x-oldX);
int diff2=(location.y-oldY);
if (abs(diff1)>=5 || abs(diff2)>=5 || abs(diff1)%5==0 || abs(diff2)%5==0)
{
[myImageView setCenter:CGPointMake(location.x, location.y)];
}
有没有办法在 Cocoa Touch 中改进它?如果没有,我应该切换到CoreGraphics 或 cocos2d 等吗?
帮助示例代码 sn-ps 将不胜感激。
【问题讨论】:
标签: iphone ios cocoa-touch uiviewcontroller uiimageview