- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event - (void)touchesCancelled:(NSSet *)touches withEvent:(UIEvent *)event - (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event - (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
-(void) viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view from its nib.
UIPanGestureRecognizer *panRecognizer = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handlePanFrom:)];
[self.view addGestureRecognizer:panRecognizer];//关键语句,给self.view添加一个手势监测;
panRecognizer.maximumNumberOfTouches = 1;
panRecognizer.delegate = self;
[panRecognizer release];
}
- (void)viewDidLoad
{
// 单击的 Recognizer
UITapGestureRecognizer* singleRecognizer;
singleRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:selfaction:@selector(SingleTap:)];
//点击的次数
singleTapRecognizer.numberOfTapsRequired = 1; // 单击
//给self.view添加一个手势监测;
[self.view addGestureRecognizer:singleRecognizer];
// 双击的 Recognizer
UITapGestureRecognizer* doubleRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:selfaction:@selector(DoubleTap:)];
doubleRecognizer.numberOfTapsRequired = 2; // 双击
//关键语句,给self.view添加一个手势监测;
[self.view addGestureRecognizer:doubleRecognizer];
// 关键在这一行,双击手势确定监测失败才会触发单击手势的相应操作
[singleRecognizer requireGestureRecognizerToFail:doubleRecognizer];
[singleRecognizer release];
[doubleRecognizer release];
}
-(void)SingleTap:(UITapGestureRecognizer*)recognizer
{
//处理单击操作
}
-(void)DoubleTap:(UITapGestureRecognizer*)recognizer
{
//处理双击操作
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有