这是我的相关代码:
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
,如何解决这个问题?
编译器正在抱怨,因为UIEventTypeTouches是一个NSInteger(在枚举中定义),而touchesMoved:withEvent:
需要一个UIEvent
对象。您可能只需要为事件参数传递nil
就可以了
[self touchesMoved:[NSSet setWithArray:touches] withEvent:nil];