gpt4 book ai didi

ios - 快速滑动手势识别器

转载 作者:行者123 更新时间:2023-11-28 18:55:12 25 4
gpt4 key购买 nike

我已经在互联网上搜索了几个小时,了解如何使用滑动手势识别器。我不想编写代码,因为我几乎尝试了每一个示例,但都行不通。但是,我知道对象库中有一个Swipe Gesture Recognizer,但是好像没有用。有人可以给我一个链接,指向一个可以使用对象库中的滑动手势识别器的地方,或者告诉我如何使用吗?

谢谢,

(如果我出于某种原因过于宽泛,或者您不喜欢我的问题,请不要 -1 这个,请发表评论,我会做出更改)。

崩溃日志:2016-01-09 10:59:33.392 Capitals[250:14059]-[Capitals.Alabama1 handleSwipes]:无法识别的选择器发送到实例 0x14f6951502016-01-09 10:59:33.397 Capitals[250:14059] * 由于未捕获的异常“NSInvalidArgumentException”而终止应用程序,原因:“-[Capitals.Alabama1 handleSwipes]:无法识别的选择器发送到实例 0x14f695150”* 首先抛出调用栈:(0x184bdcf48 0x19984ff80 0x184be3c5c 0x184be0c00 0x184ae4cac 0x18a6eb330 0x18a314b5c 0x18a1a285c 0x18a6ec70c 0x18a1618b8 0x18a15e 63c 0x18a1a06cc 0x18a19fcc8 0x18a1704a4 0x18a16e76c 0x184b94544 0x184b93fd8 0x184b91cd8 0x184ac0ca0 0x18fb40088 0x18a1d8ffc 0x10 008a264 0x19a0928b8)libc++abi.dylib:以 NSException 类型的未捕获异常终止

(Handle Swipes 是函数名)

代码如下:

导入 UIKit

Alabama1 类:UIViewController { @IBOutlet 弱变量标签:UILabel!

override func viewDidLoad() {
super.viewDidLoad()

let reveal = UISwipeGestureRecognizer(target: self, action: Selector("handleSwipes"))
let next = UISwipeGestureRecognizer(target: self, action: Selector("handleSwipes"))

// Do any additional setup after loading the view, typically from a nib.
reveal.direction = .Up
next.direction = .Left

view.addGestureRecognizer(reveal)
view.addGestureRecognizer(next)

}

override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}

func handleSwipes(sender:UISwipeGestureRecognizer) {
if (sender.direction == .Up) {
label.text = "Motgomery"
}

}





}

最佳答案

您在添加事件时缺少分栏。像这样尝试:

let reveal = UISwipeGestureRecognizer(target: self, action: Selector("handleSwipes:"))
let next = UISwipeGestureRecognizer(target: self, action: Selector("handleSwipes:"))

关于ios - 快速滑动手势识别器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34695926/

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