0
点赞
收藏
分享

微信扫一扫

IOS开发之——事件处理-手势识别(71),kotlin异常处理

tap.delegate=self;

[_imageView addGestureRecognizer:tap];

说明

  • tap.numberOfTapsRequired:点击多少次才能触发

  • tap.numberOfTouchesRequired:多少手势触发

方法

-(void)tap:(UITapGestureRecognizer *)tap

{

NSLog(@“tap”);

}

4.2 UILongPressGestureRecognizer

手势

UILongPressGestureRecognizer *longPress=[[UILongPressGestureRecognizer alloc]initWithTarget:self action:@selector(longPress:)];

[_imageView addGestureRecognizer:longPress];

方法

-(void)longPress:(UILongPressGestureRecognizer *)longPress

{

if (longPress.state==UIGestureRecognizerStateBegan) {

NSLog(@“longPress”);

}

}

4.3 UISwipeGestureRecognizer

手势

//swip 一个手势只能识别一个方向

UISwipeGestureRecognizer *swipe=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swip:)];

swipe.direction=UISwipeGestureRecognizerDirectionRight;

[_imageView addGestureRecognizer:swipe];

方法

-(void)swip:(UISwipeGestureRecognizer *)swipe

{

NSLog(@“swipe”);

}

4.4 UIRotationGestureRecognizer

添加手势

UIRotationGestureRecognizer *rotation=[[UIRotationGestureRecognizer alloc]initWithTarget:self action:@selector(rotation:)];

[_imageView addGestureRecognizer:rotation];

方法

-(void)rotation:(UIRotationGestureRecognizer *)rotation

{

NSLog(@"%f",rotation.rotation);

//_imageView.transform=CGAffineTransformMakeRotation(rotation.rotation);

_imageView.transform=CGAffineTransformRotate(_imageView.transform, rotation.rotation);

rotation.delegate=self;

rotation.rotation=0;

}

4.5 UIPinchGestureRecognizer

手势

UIPinchGestureRecognizer *pinch=[[UIPinchGestureRecognizer alloc]initWithTarget:self action:@selector(pinch:)];

[_imageView addGestureRecognizer:pinch];

pinch.delegate=self;

[self addRotation];

方法

-(void)pinch:(UIPinchGestureRecognizer *)pinch

{

_imageView.transform=CGAffineTransformScale(_imageView.transform, pinch.scale, pinch.scale);

//复位

pinch.scale=1;

}

4.6 UIPanGestureRecognizer

最后

这里附上上述的技术体系图相关的几十套腾讯、头条、阿里、美团等公司2021年的面试题,把技术点整理成了视频和PDF(实际上比预期多花了不少精力),包含知识脉络 + 诸多细节,由于篇幅有限,这里以图片的形式给大家展示一部分。

相信它会给大家带来很多收获:

img

上述高清技术脑图以及配套的架构技术PDF可以点击我的GitHub免费获取

当程序员容易,当一个优秀的程序员是需要不断学习的,从初级程序员到高级程序员,从初级架构师到资深架构师,或者走向管理,从技术经理到技术总监,每个阶段都需要掌握不同的能力。早早确定自己的职业方向,才能在工作和能力提升中甩开同龄人。

  • 无论你现在水平怎么样一定要 持续学习 没有鸡汤,别人看起来的毫不费力,其实费了很大力,这四个字就是我的建议!!!
  • 我希望每一个努力生活的IT工程师,都会得到自己想要的,因为我们很辛苦,我们应得的。

不断学习的,从初级程序员到高级程序员,从初级架构师到资深架构师,或者走向管理,从技术经理到技术总监,每个阶段都需要掌握不同的能力。早早确定自己的职业方向,才能在工作和能力提升中甩开同龄人。

  • 无论你现在水平怎么样一定要 持续学习 没有鸡汤,别人看起来的毫不费力,其实费了很大力,这四个字就是我的建议!!!
  • 我希望每一个努力生活的IT工程师,都会得到自己想要的,因为我们很辛苦,我们应得的。
举报

相关推荐

0 条评论