一、我们来说这个长按啊,

1.长按这个手势,也是,步骤都是一样的,首先,也是这三大步啊,
1)创建手势对象
2)对某一个view添加手势
3)实现手势的方法

首先,也是三大步,
1)创建手势对象:首先,你要告诉我,你要使用哪一个手势,我要使用一个叫做UILongPressGestureRecognizer,的手势,

LongPress:长按,啊,我要使用一个长按的手势,然后呢,星号,longPress,
UILongPressGestureRecognizer *longPress =

等于,一个,[[UILongPressGestureRecognizer alloc] initWithTarget:(id) selector:(SEL)];

输入两个参数,
1)initWithTarget:(id),来一个self,
2)action:(SEL),来一个@selector(longPress:)

把自己也传过来,longPress,冒号,
然后呢,这个方法,创建这个对象,就搞定了,

2)然后呢,你要给谁去做,我要给self.imageView,去添加这个手势,
[self.imageView addGestureRecognizer:longPress];

方法叫做,addGestureRecognizer:(UIGestureRecognizer *)
然后呢,把这个longPress,传进来,

3)然后呢,接下来,是实现这个手势的这个方法啊,我们就来实现一下,
// 3.实现手势的方法
- (void)longPress:(UILongPressGestureRecognizer *)sender{
}
传自己,传的是一个UILongPress的一个类型,星号,sender,

然后,在这个里边,我们开始来写,长按的一些事件,
可以在这里,NSLog(@“longPress”);
command + R,

![[牛客网]——C语言刷题day4](https://img-blog.csdnimg.cn/direct/f645835f7037497099f6a77ed52cd21d.png)













![[通俗易懂]《动手学强化学习》学习笔记3-第5-13章](https://img-blog.csdnimg.cn/direct/f4a454a80b834a68a0c6941a2adc4370.png)




