检测滚动视图上的 PinchGesture END
我有一个滚动视图,我想在捏合手势结束时对其执行操作。
SampleController.h
@interface SampleController : UIViewController <UIPopoverControllerDelegate,UITableViewDelegate>{
IBOutlet UIScrollView *mapScrollView;
}
@property (nonatomic, retain) IBOutlet UIScrollView *mapScrollView;
@end
SampleController.m
@implementation SampleController
@synthesize mapScrollView;
- (void)viewDidLoad {
[super viewDidLoad];
UIPinchGestureRecognizer *pinchRecognizer =
[[UIPinchGestureRecognizer alloc]
initWithTarget:self
action:@selector(handlePinchFrom:)];
[mapScrollView addGestureRecognizer:pinchRecognizer];
[pinchRecognizer release];
}
- (void)handlePinchFrom:(UIPinchGestureRecognizer *)recognizer {
if(recognizer.state == UIGestureRecognizerStateEnded)
{
NSLog(@"handleTapEND");
}
else
{
NSLog(@"zooming ...");
}
}
- (void)dealloc {
[mapScrollView release];
[super dealloc];
}
@end
我的问题是:
当我有inchRecognizer时,它会阻止mapScrollView的滚动。
是否有其他方法来检测 ScrollView 上滚动或缩放的结束?
谢谢,
布鲁诺
I have a scrollView on which I want to do an action when the pinch gesture is ended.
SampleController.h
@interface SampleController : UIViewController <UIPopoverControllerDelegate,UITableViewDelegate>{
IBOutlet UIScrollView *mapScrollView;
}
@property (nonatomic, retain) IBOutlet UIScrollView *mapScrollView;
@end
SampleController.m
@implementation SampleController
@synthesize mapScrollView;
- (void)viewDidLoad {
[super viewDidLoad];
UIPinchGestureRecognizer *pinchRecognizer =
[[UIPinchGestureRecognizer alloc]
initWithTarget:self
action:@selector(handlePinchFrom:)];
[mapScrollView addGestureRecognizer:pinchRecognizer];
[pinchRecognizer release];
}
- (void)handlePinchFrom:(UIPinchGestureRecognizer *)recognizer {
if(recognizer.state == UIGestureRecognizerStateEnded)
{
NSLog(@"handleTapEND");
}
else
{
NSLog(@"zooming ...");
}
}
- (void)dealloc {
[mapScrollView release];
[super dealloc];
}
@end
My problem is :
When I had the pinchRecognizer it blocks the scrolling of mapScrollView.
Is there an other way to detect the end of a scrolling or a zooming on a ScrollView ?
Thanks,
Bruno
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我找到了一个解决方案:
我的控制器上有一个计时器,如果发生滚动或拖动,它会继续执行操作:
I've found a solution :
I had a timer on my controller which proceed the action if a scroll or a dragg happend :