簡體   English   中英

Swift 2:通過UISwipeGestureRecognizer顯示視圖控制器。 如何使視圖控制器跟隨我的手指

[英]Swift 2: Showing View Controller by UISwipeGestureRecognizer. How do I make the view controller follow my finger

我正在使用UISwipeGestureRecognizer來顯示另一個視圖控制器,

而且我不知道如何使View Controller順着我的手指。

我該怎么做呢?

方向是從下到上,如果被滑動,則會顯示另一個View控制器。

如何使這個View Controller順着我的手指?

// ------------視圖中向右輕掃手勢-------------- //

    let swipeRight = UISwipeGestureRecognizer(target: self, action: Selector("rightSwiped"))
    swipeRight.direction = UISwipeGestureRecognizerDirection.Right
    self.view.addGestureRecognizer(swipeRight)

//調用方法:

   func rightSwiped()
    {
        self.navigationController?.popViewControllerAnimated(true)
    }

您想要pushView Controller,然后在上面的代碼中使用UISwipeGestureRecognizerDirection.Left

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM