From 9a84ca700ea3767f26414934d3c27f9f640e1d41 Mon Sep 17 00:00:00 2001 From: ashagross Date: Sat, 9 Jan 2021 14:23:14 -0500 Subject: [PATCH] Project Complete --- Magic 8 Ball/Base.lproj/Main.storyboard | 43 ++++++++++++++++++++++--- Magic 8 Ball/ViewController.swift | 7 ++++ 2 files changed, 45 insertions(+), 5 deletions(-) diff --git a/Magic 8 Ball/Base.lproj/Main.storyboard b/Magic 8 Ball/Base.lproj/Main.storyboard index 2766965..03078d7 100644 --- a/Magic 8 Ball/Base.lproj/Main.storyboard +++ b/Magic 8 Ball/Base.lproj/Main.storyboard @@ -1,7 +1,9 @@ - + + - + + @@ -9,16 +11,47 @@ - + - + - + + + + + + + + + + + + + + + + diff --git a/Magic 8 Ball/ViewController.swift b/Magic 8 Ball/ViewController.swift index 13dc436..045a9cb 100644 --- a/Magic 8 Ball/ViewController.swift +++ b/Magic 8 Ball/ViewController.swift @@ -10,8 +10,15 @@ import UIKit class ViewController: UIViewController { + @IBOutlet weak var imgageView: UIImageView! + @IBAction func askButtonPressed(_ sender: UIButton) { + let randomBall = ballArray.randomElement() + imgageView.image = randomBall + } let ballArray = [#imageLiteral(resourceName: "ball1.png"),#imageLiteral(resourceName: "ball2.png"),#imageLiteral(resourceName: "ball3.png"),#imageLiteral(resourceName: "ball4.png"),#imageLiteral(resourceName: "ball5.png")] + + }