Ios '的隐式转换;NSInteger&x27;(又名int';)到';UIEvent*';不允许使用ARC
这是我的相关代码:Ios '的隐式转换;NSInteger&x27;(又名int';)到';UIEvent*';不允许使用ARC,ios,automatic-ref-counting,uievent,Ios,Automatic Ref Counting,Uievent,这是我的相关代码: UITouch *touch; NSArray *touches = [NSArray arrayWithObject:touch]; //The statement below throw the LLVM compiler error [self touchesMoved:[NSSet setWithArray:touches] withEvent:UIEventTypeTouches]; 以下是touchsmoved:withEvent:方法的声明:
UITouch *touch;
NSArray *touches = [NSArray arrayWithObject:touch];
//The statement below throw the LLVM compiler error
[self touchesMoved:[NSSet setWithArray:touches] withEvent:UIEventTypeTouches];
以下是touchsmoved:withEvent:
方法的声明:
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event;
似乎我需要显式地将
uieventtypetoucks
转换为UIEvent
,如何解决这个问题 编译器正在抱怨,因为UIEventTypeTouchs是一个NSInteger(在枚举中定义),而touchesMoved:withEvent:
需要一个UIEvent
对象。您可能只需传递事件参数的nil
,就可以成功:
[self touchesMoved:[NSSet setWithArray:touches] withEvent:nil];
你想干什么?您不能手动调用
touchsmoved:withEvent:
。您可以将其实现为委托方法,也可以在uigesturecognizer
子类中重写它。