亚洲乱码中文字幕综合,中国熟女仑乱hd,亚洲精品乱拍国产一区二区三区,一本大道卡一卡二卡三乱码全集资源,又粗又黄又硬又爽的免费视频

Swift中實(shí)現(xiàn)點(diǎn)擊、雙擊、捏、旋轉(zhuǎn)、拖動(dòng)、劃動(dòng)、長(zhǎng)按手勢(shì)的類和方法介紹

 更新時(shí)間:2015年01月09日 12:46:34   投稿:junjie  
這篇文章主要介紹了Swift中實(shí)現(xiàn)點(diǎn)擊、雙擊、捏、旋轉(zhuǎn)、拖動(dòng)、劃動(dòng)、長(zhǎng)按手勢(shì)的類和方法介紹,本文分別給出了各種手勢(shì)的實(shí)現(xiàn)代碼,需要的朋友可以參考下

1.UITapGestureRecognizer 點(diǎn)擊/雙擊手勢(shì)

復(fù)制代碼 代碼如下:

var tapGesture = UITapGestureRecognizer(target: self, action: "handleTapGesture:") 
//設(shè)置手勢(shì)點(diǎn)擊數(shù),雙擊:點(diǎn)2下 
tapGesture.numberOfTapsRequired = 2 
self.view.addGestureRecognizer(tapGesture)

2.UIPinchGestureRecognizer 捏 (放大/縮小)手勢(shì)
復(fù)制代碼 代碼如下:

var pinchGesture = UIPinchGestureRecognizer(target: self, action: "handlePinchGesture:") 
self.view.addGestureRecognizer(pinchGesture)

3.UIRotationGestureRecognizer 旋轉(zhuǎn)手勢(shì)
復(fù)制代碼 代碼如下:

var rotateGesture = UIRotationGestureRecognizer(target: self, action: "handleRotateGesture:") 
 self.view.addGestureRecognizer(rotateGesture) 

4. UIPanGestureRecognizer 拖動(dòng)手勢(shì)
復(fù)制代碼 代碼如下:

 var panGesture = UIPanGestureRecognizer(target: self, action: "handlePanGesture:") 
 self.view.addGestureRecognizer(panGesture) 

5. UISwipeGestureRecognizer 劃動(dòng)手勢(shì)
復(fù)制代碼 代碼如下:

var swipeGesture = UISwipeGestureRecognizer(target: self, action: "handleSwipeGesture:") 
swipeGesture.direction = UISwipeGestureRecognizerDirection.Left //不設(shè)置是右 
self.view.addGestureRecognizer(swipeGesture)

6. UILongPressGestureRecognizer 長(zhǎng)按手勢(shì)
復(fù)制代碼 代碼如下:

   var longpressGesutre = UILongPressGestureRecognizer(target: self, action: "handleLongpressGesture:") 
    //長(zhǎng)按時(shí)間 
    // longpressGesutre.minimumPressDuration
    //所需觸摸次數(shù)
    /// longpressGesutre.numberOfTouchesRequired 
    self.view.addGestureRecognizer(longpressGesutre) 
UIGestureRecognizerState 枚舉定義如下

enum UIGestureRecognizerState : Int {

    case Possible // the recognizer has not yet recognized its gesture, but may be evaluating touch events. this is the default state

    case Began // the recognizer has received touches recognized as the gesture. the action method will be called at the next turn of the run loop
    case Changed // the recognizer has received touches recognized as a change to the gesture. the action method will be called at the next turn of the run loop
    case Ended // the recognizer has received touches recognized as the end of the gesture. the action method will be called at the next turn of the run loop and the recognizer will be reset to UIGestureRecognizerStatePossible
    case Cancelled // the recognizer has received touches resulting in the cancellation of the gesture. the action method will be called at the next turn of the run loop. the recognizer will be reset to UIGestureRecognizerStatePossible

    case Failed // the recognizer has received a touch sequence that can not be recognized as the gesture. the action method will not be called and the recognizer will be reset to UIGestureRecognizerStatePossible
}

相關(guān)文章

  • SwiftUI 中創(chuàng)建反彈動(dòng)畫的實(shí)現(xiàn)

    SwiftUI 中創(chuàng)建反彈動(dòng)畫的實(shí)現(xiàn)

    這篇文章主要介紹了SwiftUI 中創(chuàng)建反彈動(dòng)畫的實(shí)現(xiàn),文中通過示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來一起學(xué)習(xí)學(xué)習(xí)吧
    2020-10-10
  • swift3.0指紋解鎖的實(shí)現(xiàn)方法

    swift3.0指紋解鎖的實(shí)現(xiàn)方法

    這篇文章主要為大家詳細(xì)介紹了swift3.0指紋解鎖的實(shí)現(xiàn)方法,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-03-03
  • Swift中閉包實(shí)戰(zhàn)案例詳解

    Swift中閉包實(shí)戰(zhàn)案例詳解

    接觸過Swift的小伙伴對(duì)“閉包”應(yīng)該不陌生,相當(dāng)于OC中的Block,是Swift語(yǔ)法中比較難理解的一塊。下面這篇文章主要介紹了關(guān)于Swift中閉包實(shí)戰(zhàn)的相關(guān)資料,需要的朋友可以參考借鑒,下面來一起看看吧。
    2017-03-03
  • switch實(shí)現(xiàn)一個(gè)兩數(shù)的運(yùn)算代碼示例

    switch實(shí)現(xiàn)一個(gè)兩數(shù)的運(yùn)算代碼示例

    這篇文章主要介紹了switch實(shí)現(xiàn)一個(gè)兩數(shù)的運(yùn)算代碼示例,需要的朋友可以參考下
    2017-06-06
  • mac git xcrun error active developer path 錯(cuò)誤

    mac git xcrun error active developer path 錯(cuò)誤

    本文主要是講訴了如何解決在mac下使用git;xcode4.6的環(huán)境時(shí),出現(xiàn)了錯(cuò)誤(mac git xcrun error active developer path)的解決辦法,希望對(duì)大家有所幫助
    2014-09-09
  • 詳解Swift編程中的常量和變量

    詳解Swift編程中的常量和變量

    這篇文章主要介紹了Swift編程中的常量和變量,是Swift入門學(xué)習(xí)中的基礎(chǔ)知識(shí),需要的朋友可以參考下
    2015-11-11
  • 判斷?ScrollView List?是否正在滾動(dòng)詳解

    判斷?ScrollView List?是否正在滾動(dòng)詳解

    這篇文章主要為大家介紹了判斷?ScrollView、List?是否正在滾動(dòng)示例詳解,有需要的朋友可以借鑒參考下,希望能夠有所幫助,祝大家多多進(jìn)步,早日升職加薪
    2022-09-09
  • openstack重啟swift服務(wù)后報(bào)錯(cuò)問題解決方案

    openstack重啟swift服務(wù)后報(bào)錯(cuò)問題解決方案

    這篇文章主要介紹了解決openstack重啟swift服務(wù)后報(bào)錯(cuò),本文給大家介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或工作具有一定的參考借鑒價(jià)值,需要的朋友可以參考下
    2023-08-08
  • Swift里的值類型與引用類型區(qū)別和使用

    Swift里的值類型與引用類型區(qū)別和使用

    這篇文章主要介紹了Swift里的值類型與引用類型區(qū)別和使用,本文講解了值類型與引用類型的區(qū)別、如何選擇類型、什么時(shí)候該用值類型、什么時(shí)候該用引用類型等內(nèi)容,需要的朋友可以參考下
    2015-05-05
  • iOS Swift UICollectionView橫向分頁(yè)滾動(dòng),cell左右排版問題詳解

    iOS Swift UICollectionView橫向分頁(yè)滾動(dòng),cell左右排版問題詳解

    UICollectionView是iOS中比較常見的一個(gè)控件,這篇文章主要給大家介紹了關(guān)于iOS Swift UICollectionView橫向分頁(yè)滾動(dòng),cell左右排版問題的相關(guān)資料,文中通過示例代碼介紹的非常詳細(xì),需要的朋友可以參考借鑒,下面隨小編來一起學(xué)習(xí)學(xué)習(xí)吧。
    2017-12-12

最新評(píng)論