swift初心者です。
segmented Controlのボタンを押すとViewの色が変わるコードを書いています。
しかし、ボタンを押しても反応してくれません。
分かる方、ご教授願います。
swift
1import UIKit 2 3class ViewController: UIViewController { 4 5 @IBOutlet weak var ColorView2: UIView! 6 7 @IBAction func changedColor(_ sender: UISegmentedControl) { 8 9 switch sender.selectedSegmentIndex { 10 case 0: 11 ColorView2.backgroundColor = UIColor.blue 12 case 1: 13 ColorView2.backgroundColor = UIColor.red 14 case 2: 15 ColorView2.backgroundColor = UIColor.green 16 default: 17 ColorView2.backgroundColor = UIColor.blue 18 } 19 }
###バージョン
x code:9.2
swift:4.0.3
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
退会済みユーザー
2018/02/04 04:01
2018/02/04 04:59
退会済みユーザー
2018/02/04 06:25
退会済みユーザー
2018/02/04 06:33
2018/02/04 06:51
退会済みユーザー
2018/02/04 06:54