gpt4 book ai didi

ios - 未检测到滑动(Swift/iOS9)

转载 作者:行者123 更新时间:2023-11-30 13:46:18 26 4
gpt4 key购买 nike

在我的viewDidLoad中:

let swipeLeft = UISwipeGestureRecognizer(target: self, action: Selector("leftSwiped"))
swipeLeft.direction = .Left
self.view.addGestureRecognizer(swipeLeft

)

func leftSwiped()
{
print("here")
}

“here”永远不会被打印。我尝试查看其他指南,但代码的核心与我的相同。我认为我不应该对任何东西进行子类化。我可以得到一些帮助吗?

最佳答案

let swipeLeft = UISwipeGestureRecognizer(target: self, action: Selector("leftSwiped"))

名称函数“leftSwiped”后缺少“:

尝试源代码:

let swipeLeft = UISwipeGestureRecognizer(target: self, action: Selector("leftSwiped:"))

swipeLeft.direction = .Left

self.view.addGestureRecognizer(swipeLeft)

关于ios - 未检测到滑动(Swift/iOS9),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34888761/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com