【发布时间】:2014-02-06 23:49:56
【问题描述】:
我正在编写一个 iOS 应用程序,但我似乎无法弄清楚如何进行连续触摸事件。我尝试使用“touchesBegan”和“touchesEnd”功能,但它们不适用于连续触摸。
所以基本上我现在的情况如下:
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[super touchesBegan:touches withEvent:event];
UITouch *touch = [touches anyObject];
if([touch view] == [self viewWithTag:kTag])
{
CGFloat yOffset = contentView.contentOffset.y;
yOffset ++;
[contentView setContentOffset:CGPointMake(0, yOffset)];
}
}
但是,只要我的手指触摸给定的视图,我希望内容偏移继续无限期地移动。现在它在一次迭代后停止。
【问题讨论】:
-
您在寻找什么?如果您收到 touchesBegan,那么它会一直持续到您收到 touchesEnded。
标签: ios iphone objective-c uiview touch