iCarousel 项目捏和平移
Posted
技术标签:
【中文标题】iCarousel 项目捏和平移【英文标题】:iCarousel item pinch and pan 【发布时间】:2016-11-02 09:41:29 【问题描述】:我正在尝试为 iCarousel
项目视图实现缩放功能。这是我的代码:
NSString *pathToHDImage = [documentsFolderPath stringByAppendingPathComponent:solution.localHDURL];
if (!view)
view = [[AsyncImageView alloc] initWithFrame:self.view.bounds];
view.contentMode = UIViewContentModeScaleAspectFit;
UIPinchGestureRecognizer *pinchGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)];
pinchGesture.cancelsTouchesInView = false;
UIPanGestureRecognizer *panGesture = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePan:)];
panGesture.cancelsTouchesInView = false;
pinchGesture.delegate = panGesture.delegate = self;
[view addGestureRecognizer:pinchGesture];
[view addGestureRecognizer:panGesture];
((AsyncImageView *)view).imageURL = [NSURL fileURLWithPath:pathToHDImage];
else
((AsyncImageView *)view).imageURL = [NSURL fileURLWithPath:pathToHDImage];
问题是我的handlePan:
和handlePinch:
永远不会被调用。我能怎么做?主要目标是为每个 iCarousel
项目视图实现缩放功能。
【问题讨论】:
【参考方案1】:试试这个代码:
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer
return YES;
我没有测试,但我希望它有所帮助。 如果它不起作用,请查看此link1,然后查看此link2
【讨论】:
不幸的是,这没有帮助,没有变化以上是关于iCarousel 项目捏和平移的主要内容,如果未能解决你的问题,请参考以下文章