http://minsone.github.io/mac/ios/uigesturerecognizer
참고하여 나는 이런식으로 썼다!
override func viewDidLoad() {
super.viewDidLoad()
initUi()
let swipeUp = UISwipeGestureRecognizer(target: self, action: #selector(self.didSwipe(swipeGes:)))
let swipeDown = UISwipeGestureRecognizer(target: self, action: #selector(self.didSwipe(swipeGes:)))
swipeUp.direction = .up
swipeDown.direction = .down
self.view.gestureRecognizers = [swipeUp, swipeDown]
initUi()
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
}
func didSwipe(swipeGes : UISwipeGestureRecognizer) {
switch (swipeGes.direction) {
case UISwipeGestureRecognizerDirection.down:
print("Swiped down")
case UISwipeGestureRecognizerDirection.up:
print("Swiped up")
default:
break
}
}
'개발 > swift' 카테고리의 다른 글
버튼 이벤트 다른 컨트롤러의 func 불러오기 (0) | 2016.10.21 |
---|---|
UItableView 회전 (0) | 2016.10.14 |
swift3 numberOfSectionsInTableView (0) | 2016.09.19 |
lazy is only vaild for member of struct of class (0) | 2016.09.06 |
테이블 맨 위로 올리기(top) (0) | 2016.09.05 |
댓글