如何使用Swift制作随机颜色

如何使用Swift创建随机颜色函数?

import UIKit

class ViewController: UIViewController {

    var randomNumber = arc4random_uniform(20)
    var randomColor = arc4random()

    //Color Background randomly
    func colorBackground() {

        // TODO: set a random color
        view.backgroundColor = UIColor.yellow

    }
}

转载请注明出处:http://www.cjhyc.com/article/20230606/905895.html