[英]Implicit conversion of 'int' to 'NSArray*' is disallowed with ARC
[英]implicit conversion of 'NSInteger' (aka 'int') to 'UIEvent *' is disallowed with ARC
这是我的相关代码:
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];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.