【发布时间】:2015-04-20 22:02:11
【问题描述】:
我正在 Swift (XCode 6.2) 中制作一个非常简单的单视图应用程序,其中包含 2 个按钮“blackButton”和“whiteButton”。单击 blackButton 时,它将视图的背景颜色更改为黑色,单击 whiteButton 时,它将背景更改为白色。谁能建议任何可能的方法来做到这一点?
ViewController.swift:
//beginning
import UIKit
class ViewController: UIViewController {
@IBAction func blackButton(sender: AnyObject) {
}
@IBAction func whiteButton(sender: AnyObject) {
}
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.
}
}
【问题讨论】:
标签: ios swift uiviewcontroller