gpt4 book ai didi

ios - 检测按钮被点击 - iOS

转载 作者:塔克拉玛干 更新时间:2023-11-01 21:25:01 25 4
gpt4 key购买 nike

我正在使用 objective-c,我想检测用户何时点击按钮(不是他点击按钮的时间,而是被录音直到他停止的实际时刻)。有什么方法吗?如果有的话,我找不到它。谢谢

最佳答案

使用 touchDown 事件,您可以在按下按钮时执行操作

enter image description here

示例

import UIKit

class ViewController: UIViewController {

@IBOutlet weak var label: UILabel!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
}

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

@IBAction func testing(_ sender: Any) {
label.textColor = UIColor.red
}

@IBAction func testingCancel(_ sender: Any) {
label.textColor = UIColor.black
}

@IBAction func testingUpInside(_ sender: Any) {
label.textColor = UIColor.black
}


}

关于ios - 检测按钮被点击 - iOS,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/48642189/

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