@IBAction func getOmikuji(sender: AnyObject) { // 0 - n // arc4random_uniform(n + 1) let random = arc4random_uniform(10) self.myLabel.text = String(random) }
おーおーお
@IBOutlet weak var myLabel: UILabel! @IBAction func getOmikuji(sender: AnyObject) { // 0 - n // arc4random_uniform(n + 1) let results = ["大吉", "中吉","吉", "大凶"] let random = arc4random_uniform(UInt32(results.count)) self.myLabel.text = results[Int(random)] } override func viewDidLoad() { super.viewDidLoad() // myLabel.layer.borderColor = UIColor.orange.cgColor // myLabel.layer.borderWidth = 5 // myLabel.layer.cornerRadius = 50 myLabel.layer.masksToBounds = true myLabel.layer.cornerRadius = myLabel.bounds.width / 2 // Do any additional setup after loading the view, typically from a nib. }