0

这是我的相关代码:

UITouch *touch;         
NSArray *touches = [NSArray arrayWithObject:touch];
//The statement below throw the LLVM compiler error
[self touchesMoved:[NSSet setWithArray:touches] withEvent:UIEventTypeTouches];

这是touchesMoved:withEvent:方法的声明:

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;

好像我需要显式转换UIEventTypeTouchesUIEvent,如何解决?

4

1 回答 1

0

编译器抱怨是因为 UIEventTypeTouches 是一个 NSInteger (在枚举中定义)并且touchesMoved:withEvent:需要一个UIEvent对象。您可能只需传递nil事件参数就可以逃脱:

[self touchesMoved:[NSSet setWithArray:touches] withEvent:nil];
于 2013-07-12T13:59:41.473 回答