日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

iOS中常用的手势

發布時間:2023/12/20 编程问答 21 豆豆
生活随笔 收集整理的這篇文章主要介紹了 iOS中常用的手势 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

--前言

智能手機問世后的很長一段時間,各大手機廠商都在思考著智能手機應該怎么玩?也都在嘗試著制定自己的一套操作方式。直到2007年喬布斯發布了iPhone手機,人們才認識到智能手機就應該這樣玩。

真正讓廣大生產廠商驚掉下巴的是2010年6月8號發布的iPhone4。之前的iPhone基本都是極客玩物,很多大廠如NOKIA,摩托羅拉并沒有把它看作一個夠體量的對手。

下圖是2009年11月的國美手機銷售排行榜:

2010年6月的手機雜志的封面iPhone就已經占據上風了。可以看出當時的NOKIA E72還是很火,很多中高端手機還沒有加入觸控功能:

iPhone在操作上的創舉,很大程度上取決于用戶在iPhone屏幕上實用的操作手勢。

?

--正文

iOS上常用的手勢有以下七種:

1、點擊手勢(單擊、雙擊)

UITapGestureRecognizer *singleTap = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(processgestureReconizer:)]; singleTap.numberOfTapsRequired = 1; [self.view addGestureRecognizer:singleTap];

?

2、拖拽手勢

UIPanGestureRecognizer *pan = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(processgestureReconizer:)]; [self.view addGestureRecognizer:pan];

?

3、捏合手勢(縮放)

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

?

4、旋轉手勢

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

?

5、輕掃手勢(從左到右、從右到左、從上到下、從下到上)

UISwipeGestureRecognizer *leftSwipe = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(processgestureReconizer:)]; leftSwipe.direction = UISwipeGestureRecognizerDirectionLeft; [self.view addGestureRecognizer:leftSwipe];

?

6、長按手勢

UILongPressGestureRecognizer *longPress = [[UILongPressGestureRecognizer alloc] initWithTarget:self action:@selector(processgestureReconizer:)]; longPress.minimumPressDuration = 2.0; [self.view addGestureRecognizer:longPress];

?

7、邊緣滑動手勢(左滑退出)

UIScreenEdgePanGestureRecognizer edgePan = [[UIScreenEdgePanGestureRecognizer alloc]initWithTarget:self action:@selector(edgePanAction:)]; edgePan.edges = UIRectEdgeLeft; [self.view addGestureRecognizer:edgePan];

?

--另外

手勢是可以自定義的,上面列舉的手勢類都是UIGestureRecognizer類的子類。通過子類化UIGestureRecognizer可以制定出各種手勢,比如iPhone設置中的自定義手勢(用手指畫一個‘勾’以后觸發某種活動)。

如果UIGestureRecognizer類都讓你束手束腳,高手的你也可以直接使用像UITouch這樣的類,來高度自定義各種“手法”。

?

轉載于:https://www.cnblogs.com/cchHers/p/10132099.html

總結

以上是生活随笔為你收集整理的iOS中常用的手势的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。