在我的viewDidLoad
:
let swipeLeft = UISwipeGestureRecognizer(target: self, action: Selector("leftSwiped"))
swipeLeft.direction = .Left
self.view.addGestureRecognizer(swipeLeft
func leftSwiped()
{
print("here")
}
永远不会打印“这里”。我试着查看其他指南,但代码的核心与我的相同。我认为我不应该继承任何东西。我可以得到一些帮助吗?
答案 0 :(得分:0)
让swipeLeft = UISwipeGestureRecognizer(目标:自我,行动: 选择器(" leftSwiped&#34))
你错过了" :"在姓名功能" leftSwiped "
之后尝试源代码:
let swipeLeft = UISwipeGestureRecognizer(target: self, action: Selector("leftSwiped:"))
swipeLeft.direction = .Left
self.view.addGestureRecognizer(swipeLeft)