Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/ios/95.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ios '的隐式转换;NSInteger&x27;(又名int';)到';UIEvent*';不允许使用ARC_Ios_Automatic Ref Counting_Uievent - Fatal编程技术网

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
子类中重写它。