UIButtonの文字を動的に変更したい場合はIBActionに記述します。
以下のように設定することで、ボタンがタップされた時に文字が変更します。
@IBAction func greeting(_ sender: UIButton) {
sender.titleLabel?.text = "こんにちは!"
}
UIButtonの文字を動的に変更したい場合はIBActionに記述します。
以下のように設定することで、ボタンがタップされた時に文字が変更します。
@IBAction func greeting(_ sender: UIButton) {
sender.titleLabel?.text = "こんにちは!"
}