๋ณธ ๋ด์ฉ์ '์คํ๋ฅดํ์ฝ๋ฉํด๋ฝ' iOS๋ฐ ํ์ต์๋ฃ๋ฅผ ์ฐธ๊ณ ํ์ฌ ๋ง๋ค์์ต๋๋ค :)
On/Off ๋ฒํผ์ ๋ฐ๋ผ
FLASH, ํ๋์ฌ๋ชจ์ ์์ด์ฝ, ๋ฐฐ๊ฒฝ์ ๋ฐ๋.
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var imageView: UIImageView!
//flash image ์ฐ๊ฒฐ
@IBOutlet weak var label: UILabel!
//FLASH label ์ฐ๊ฒฐ
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
}
@IBAction func buttonDidClicked(_ sender: Any) {
// On ๋ฒํผ๊ณผ ์ฐ๊ฒฐ
view.backgroundColor = UIColor.white // ๋ฐฑ๊ทธ๋ผ์ด๋ ์ ๋ณ๊ฒฝ
label.textColor = UIColor.black // label ์ ๋ณ๊ฒฝ
imageView.image = UIImage(systemName: "flashlight.on.fill")
// ์ด๋ฏธ์ง๋ทฐ ๋ณ๊ฒฝ
}
@IBAction func offButtonClick(_ sender: Any) {
view.backgroundColor = UIColor.black
label.textColor = UIColor.white
imageView.image = UIImage(systemName: "flashlight.off.fill")
}
}