This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var restaurantNames = ["Cafe Deadend", "Homei", "Teakha", "Cafe Loisl", "Petite Oyster", "For Kee Restaurant", "Po's Atelier", "Bourke Street Bakery", "Haigh's Chocolate", "Palomino Espresso", "Upstate", "Traif", "Graham Avenue Meats", "Waffle & Wolf", "Five Leaves", "Cafe Lore", "Confessional", "Barrafina", "Donostia", "Royal Oak", "CASK Pub and Kitchen"] | |
var restaurantImages = ["cafedeadend.jpg", "homei.jpg", "teakha.jpg", "cafeloisl.jpg", "petiteoyster.jpg", "forkeerestaurant.jpg", "posatelier.jpg", "bourkestreetbakery.jpg", "haighschocolate.jpg", "palominoespresso.jpg", "upstate.jpg", "traif.jpg", "grahamavenuemeats.jpg", "wafflewolf.jpg", "fiveleaves.jpg", "cafelore.jpg", "confessional.jpg", "barrafina.jpg", "donostia.jpg", "royaloak.jpg", "caskpubkitchen.jpg"] | |
var restaurantLocations = ["Hong Kong", "Hong Kong", "Hong Kong", "Hong Kong", "Hong Kong", "Hong Kong", "Hong Kong", "Sydney", "Sydney", "Sydney", "New York", "New York", "New York", "New York", "New York", "New York", "New York", "L |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ViewController: UIViewController { | |
let colors = [UIColor.black, UIColor.blue] | |
var index = 0 | |
@IBOutlet weak var btnView: UIButton! | |
@IBAction func btn(_ sender: Any){ | |
btnView.backgroundColor = colors[index] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
class ViewController: UIViewController { | |
@IBOutlet weak var BtnView: UIButton! | |
var index = 0 | |
var colors = | |
[UIColor(red: 1, green: 0, blue: 0, alpha: 1), | |
UIColor(red: 1, green: 127/255, blue: 0, alpha: 1), |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//照片array | |
var logoImage:[UIImage] = [ | |
UIImage(named: "Audi")!, | |
UIImage(named: "Benz")!, | |
UIImage(named: "BMW")!, | |
UIImage(named: "Ferrari")!, | |
UIImage(named: "McLaren")!, | |
UIImage(named: "Toyota")!, | |
UIImage(named: "Volkswagen")!, | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var startNumber = 240 | |
var timer = Timer() | |
func runTime() { | |
timer = Timer.scheduledTimer(timeInterval: 1, target: self, selector: (#selector(ViewController.tTimer)), userInfo: nil, repeats: true) | |
} | |
@objc func tTimer() { | |
if startNumber > 0 { | |
startNumber -= 1 | |
numberLabel.text = String(startNumber) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@IBAction func stopButton(_ sender: Any) { | |
timer.invalidate() | |
} | |
@IBAction func resetButton(_ sender: Any) { | |
startNumber = 240 | |
numberLabel.text = String(startNumber) | |
timer.invalidate() | |
} | |