gpt4 book ai didi

ios - 使用 swift 3 更改 iOS 中的按钮标题不起作用

转载 作者:行者123 更新时间:2023-11-28 15:40:36 26 4
gpt4 key购买 nike

我正在尝试使用 setTitle 更改按钮的标题

我没有收到任何错误,我的 IBAction 正在运行,但没有任何反应。

我在这里错过了什么?

import UIKit

class ViewController: UIViewController {

@IBOutlet weak var hourTimerButton: UIButton!

@IBAction func hourTimerButton(_ sender: Any) {
hourTimerButton.setTitle("test", for: [])
print("button")
}

override func viewDidLoad() {
super.viewDidLoad()

hourTimerButton.setTitle("test", for: .normal)
hourTimerButton.setTitle("test", for: [])
}
}

最佳答案

尝试将按钮设置为正常状态。

hourTimerButton.setTitle("test", for: .normal)

关于ios - 使用 swift 3 更改 iOS 中的按钮标题不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43750617/

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