我正在使用 UIPanGesture 返回velocityInView,根据我的收集,它应该每秒返回点数。我得到的是数亿的数字和很多零......我不会在模拟器中快速移动鼠标。
我认为...
预先感谢您提供的任何帮助/建议。
编辑:请求的代码。
显示/呼叫
-(void)handlePanGesture:(UIPanGestureRecognizer *) recognizer
{
if (recognizer.state == UIGestureRecognizerStateChanged ||
recognizer.state == UIGestureRecognizerStateBegan)
{
CGPoint vel = [recognizer velocityInView:myScrollView];
//[self doSpinAnimationWithVelocity:vel.x];
NSLog([NSString stringWithFormat:@"Velocity - X-Axis - %d ", vel.x]);
NSLog([NSString stringWithFormat:@"Velocity - Y-Axis - %d ", vel.y]);
}
}
由于我的次数仍低于 10 次,因此此处为输出图像 http://www.mytheral.com/storage/Screen%20shot%202011-02-02%20at%202.50.42%20PM.png
没有你的代码很难说......
CGPoint 由 CGFloats 组成,根据您打印它们的方式,您可能会得到意想不到的结果
您传递给velocityInView:的视图必须位于视图层次结构中,在将其传递给velocityInView:方法之前,请通过查看视图上的window属性来检查它
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)