UIPanGestureRecognizer和touchesBegan没有被调用

时间:2013-11-29 17:06:50

标签: ios objective-c

在我的应用中,我添加了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];

1 个答案:

答案 0 :(得分:0)

答案是 一个svg图像不包括大小所以视图没有大小,即svg.view.frame.size.width = 0.0虽然他是可见的,我可以看到图像(非常奇怪),所以当我设置视图的框架像这样svg.view.frame = CGRectMake(100,100,400,400);事件panDetected开始发射感谢每一个。

相关问题