[英]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.