iOS 手勢辨識器概述

來源:互聯網
上載者:User

標籤:長按   ide   弧長   markdown   cat   min   ota   symbol   平移   

手勢辨識器iOS 手勢辨識器(UIGestureRecognizer)
  • 點選手勢(UITapGestureRecognizer)
  • 滑動手勢(UISwipeGestureRecognizer)
  • 旋轉手勢(UIRotationGestureRecognizer)
  • 捏合手勢( UIPinchGestureRecognizer)
  • 長按手勢( UILongPressGestureRecognizer)
  • 平移手勢( UIPanGestureRecognizer)
  • 螢幕邊緣平移手勢(UIScreenEdgePanGestureRecognizer)
UIGestureRecognizer

其相應的方法:

- initWithTarget:action:- addTarget:action:- removeTarget:action:
- locationInView:- locationOfTouch:inView:- numberOfTouches

屬性:

  • stated
  • view
  • enable
  • cancelsTouchesInView
  • delaysTouchesBegin

    這裡有一個方法,很重要,當你須要使用雙擊手勢時,單擊手勢也會出現.這個時候就要使用以下的方法:

 - requireGestureRecognizerToFail:(eg: 單擊須要雙擊失敗)
UITapGestureRecognizer
  • numberofTapsRequired (點擊的次數)
  • numberOfTouchesRequired (用的是幾根手指)
UISwipeGestureRecognizer
  • direction (移動的方向)
  • numberOfTouchesRequired
UIRotationGestureRecognizer
  • rotation (這裡是旋轉角度的絕對值,不是增量值,假設須要增量值,須要每次 rotation 置 0)
  • velocity (每秒多少弧長, radius 為 1 )
UIPinchGestureRecognizer
  • scale (假設 須要獲得增量值,也須要 scale 置 1)
  • velocity (每秒多少 scale)
UILongPressGestureRecognizer
  • minimumPressDuration
  • numberOfTouchesRequired
  • numberOfTapsRequired
  • alowableMovement(同意移動)
UIPanGestureRecognizer
  • maximumNumberOfTouches
  • minimumNumberOfTouches
- translationinView:- setTranslation:inView:- velocityView:  (速度以 CGpoint 方式返回,能夠分解為 x 和 y 兩個方向的速度 )
UIScreenEdgePanGestureRecognizer
  • edges

>
這個手勢與平移手勢有些不同,它是以螢幕邊緣的部分才乾產生效果,一般使用時須要特殊處理,否則就會與平移手勢產生衝突.由於它繼承 UIPanGestureRecognizer

iOS 手勢辨識器概述

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.