以下是我的相关代码:
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;
好像我需要明确地将UIEventTypeTouches
转换为UIEvent
,如何解决这个问题?
答案 0 :(得分:0)
编译器抱怨,因为UIEventTypeTouches是一个NSInteger(在枚举中定义),而touchesMoved:withEvent:
期待一个UIEvent
对象。你可以通过传递事件参数nil
来逃脱:
[self touchesMoved:[NSSet setWithArray:touches] withEvent:nil];