繁体   English   中英

UIPanGestureRecognizer和touches开始不被调用

[英]UIPanGestureRecognizer and touchesBegan not called

在我的应用我加入QuickSVG( https://github.com/quickcue/QuickSVG ),并将其连接到UIPanGestureRecognizer但该方法panDetected不叫我的一切子视图递归运行,并设置userInteractionEnabled = YESbringSubviewToFront但它并没有帮助请帮助我,可能是什么问题? (也touchesBegan不呼吁QuickSVG视图)

在MainViewController viewDidLoad中:

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"svgtest2" ofType:@"svg"]];

svg = [QuickSVG svgFromURL:url];

UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc]
                                        initWithTarget:self
                                        action:@selector(panDetected:)];
[svg.view addGestureRecognizer:panRecognizer];

svg.delegate = self;

[self TryToFixRecursively:svg.view];
[self.view addSubview:svg.view];

答案是一个svg图像不包括尺寸,因此视图无法获得尺寸,即svg.view.frame.size.width = 0.0虽然他是可见的,但我可以看到图像(非常奇怪),所以当我设置框架时像这样的视图svg.view.frame = CGRectMake(100,100,400,400); panDetected事件开始触发,谢谢大家。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM