我无法弄清楚出了什么问题。下面是我的代码,它调用一次委托方法然后停止。
我应该怎么办?我还没有找到使用这些委托方法的示例代码。我发现的只是滑动和点击的手势识别器,使用不同的代表。
到目前为止的代码:
-(void)initTouchesRecognizer{
DLog(@"");
recognizer = [[UIGestureRecognizer alloc] init];
[self addGestureRecognizer:recognizer];
}
-(void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
DLog(@"");
NSSet *allTouches = [event allTouches];
for (UITouch *touch in allTouches)
{
}
}
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
UITouch *touch = [[event allTouches] anyObject];
CGPoint location = [touch locationInView:touch.view];
}
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
DLog(@"");
}
- (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event {
[self touchesEnded:touches withEvent:event];
}
我从 initwithrect 调用 initTouchesRecognizer 来获取我的图像视图。
我从根本上做错了什么?