zlo*_*log 2 iphone xcode objective-c ios
在UIPanGestureRecognizer的自定义子类中,当我覆盖touchesBegan时:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
[[self view].superview bringSubviewToFront:[self view]];
[super touchesBegan:touches withEvent:event];
}
Run Code Online (Sandbox Code Playgroud)
超级线路获得警告:
....warning: 'UIPanGestureRecognizer' may not respond to '-touchesBegan:withEvent:'
... Semantic Issue: 'UIPanGestureRecognizer' may not respond to 'touchesBegan:withEvent:'
Run Code Online (Sandbox Code Playgroud)
为什么是这样?
最初尝试修复此问题的方法是根据UIGestureRecognizer的UIGestureRecognizer文档导入'UIGestureRecognizerSubclass.h',但是当我尝试这个时,我得到一个'没有这样的文件或目录'错误.
我已经包含了UIKit.framework,并尝试添加
#import <UIKit/UIKit.h>
Run Code Online (Sandbox Code Playgroud)
但它也不起作用.
我忘记了什么吗?
小智 7
这就是你需要的:
#import <UIKit/UIGestureRecognizerSubclass.h>
Run Code Online (Sandbox Code Playgroud)
此外,这里有关于iOS中的事件编程的指南,其中包含用于编写手势识别器子类的指令.
| 归档时间: |
|
| 查看次数: |
1612 次 |
| 最近记录: |