-
Notifications
You must be signed in to change notification settings - Fork 0
/
ViewController.swift
50 lines (35 loc) · 1.3 KB
/
ViewController.swift
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
//
// ViewController.swift
// HamburguesasDelMundo
//
// Created by Jonathan Silva on 31/03/16.
// Copyright © 2016 Jonathan Silva. All rights reserved.
//
import UIKit
class ViewController: UIViewController {
@IBOutlet weak var labelPais: UILabel!
@IBOutlet weak var labelHamburguesa: UILabel!
let pais = coleccionDePaises()
let hamburguesa = coleccionDeHamburguesa()
let color = colores()
@IBOutlet weak var flag: UIImageView!
@IBOutlet weak var hamburger: UIImageView!
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.
}
@IBAction func hamburguesasDelMundo(sender: AnyObject) {
let country = pais.obtenPais()
let colorAleatorio = color.obtenColor()
labelPais.text = country
labelHamburguesa.text = hamburguesa.obtenHamburguesa()
view.backgroundColor = colorAleatorio
flag.image = UIImage(named: "flags/\(country).png")
let ham = Int(arc4random()) % 4
hamburger.image = UIImage(named: "hamburger/\(ham).png")
}
}