From 4e2c967f883f6d7d22254fb826688b1af90f643c Mon Sep 17 00:00:00 2001 From: Luke Aschenbrenner Date: Fri, 5 May 2023 12:48:28 -0500 Subject: [PATCH] UI tweaks --- SoundboardQuiz.xcodeproj/project.pbxproj | 4 + .../Base.lproj/LaunchScreen.storyboard | 73 +++++-- SoundboardQuiz/Base.lproj/Main.storyboard | 180 ++++++------------ SoundboardQuiz/GradientView.swift | 51 +++++ 4 files changed, 166 insertions(+), 142 deletions(-) create mode 100644 SoundboardQuiz/GradientView.swift diff --git a/SoundboardQuiz.xcodeproj/project.pbxproj b/SoundboardQuiz.xcodeproj/project.pbxproj index 1d129ee..4e96993 100644 --- a/SoundboardQuiz.xcodeproj/project.pbxproj +++ b/SoundboardQuiz.xcodeproj/project.pbxproj @@ -27,6 +27,7 @@ 2A9093D529F72D49002DBA4F /* SoundCollectionView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A9093D429F72D49002DBA4F /* SoundCollectionView.swift */; }; 2A9093D729F73564002DBA4F /* MainGameViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A9093D629F73564002DBA4F /* MainGameViewController.swift */; }; 2A9F5AB12A02BF0700EA876A /* Sound.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A9F5AB02A02BF0700EA876A /* Sound.swift */; }; + 2A9F5AB32A05748F00EA876A /* GradientView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A9F5AB22A05748F00EA876A /* GradientView.swift */; }; 2AC1DDC129F6D292001253C3 /* SoundCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AC1DDC029F6D292001253C3 /* SoundCollectionViewCell.swift */; }; 2AC1DDC329F6D2A8001253C3 /* ImageCollectionViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AC1DDC229F6D2A8001253C3 /* ImageCollectionViewCell.swift */; }; 2AC1DDC929F6E1A2001253C3 /* TestTableViewCell.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2AC1DDC829F6E1A2001253C3 /* TestTableViewCell.swift */; }; @@ -73,6 +74,7 @@ 2A9093D429F72D49002DBA4F /* SoundCollectionView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SoundCollectionView.swift; path = SoundboardQuiz/SoundCollectionView.swift; sourceTree = ""; }; 2A9093D629F73564002DBA4F /* MainGameViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = MainGameViewController.swift; path = SoundboardQuiz/MainGameViewController.swift; sourceTree = ""; }; 2A9F5AB02A02BF0700EA876A /* Sound.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = Sound.swift; path = SoundboardQuiz/Sound.swift; sourceTree = ""; }; + 2A9F5AB22A05748F00EA876A /* GradientView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = GradientView.swift; path = SoundboardQuiz/GradientView.swift; sourceTree = ""; }; 2AC1DDC029F6D292001253C3 /* SoundCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = SoundCollectionViewCell.swift; path = SoundboardQuiz/SoundCollectionViewCell.swift; sourceTree = ""; }; 2AC1DDC229F6D2A8001253C3 /* ImageCollectionViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ImageCollectionViewCell.swift; path = SoundboardQuiz/ImageCollectionViewCell.swift; sourceTree = ""; }; 2AC1DDC829F6E1A2001253C3 /* TestTableViewCell.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TestTableViewCell.swift; sourceTree = ""; }; @@ -123,6 +125,7 @@ 2A0ACF0929F1A02E001E5D03 /* LevelSelectTableViewController.swift */, 2A0ACF2529F1A0F3001E5D03 /* LaunchScreen.storyboard */, 2A0ACF2729F1A107001E5D03 /* Main.storyboard */, + 2A9F5AB22A05748F00EA876A /* GradientView.swift */, 2A7AF4792A015F8500AF3E7B /* HighScoresViewController.swift */, 2AC744AB29FB1CF5006E0CD7 /* GameOverViewController.swift */, 2AFCB22D29FAD2B5003BD84E /* ShuffleView.swift */, @@ -269,6 +272,7 @@ buildActionMask = 2147483647; files = ( 2A9093D729F73564002DBA4F /* MainGameViewController.swift in Sources */, + 2A9F5AB32A05748F00EA876A /* GradientView.swift in Sources */, 2A9F5AB12A02BF0700EA876A /* Sound.swift in Sources */, 2A0ACF1E29F1A02F001E5D03 /* CategoryTableViewCell.swift in Sources */, 2A0ACF2329F1A02F001E5D03 /* SceneDelegate.swift in Sources */, diff --git a/SoundboardQuiz/Base.lproj/LaunchScreen.storyboard b/SoundboardQuiz/Base.lproj/LaunchScreen.storyboard index 54bae14..df0a99e 100644 --- a/SoundboardQuiz/Base.lproj/LaunchScreen.storyboard +++ b/SoundboardQuiz/Base.lproj/LaunchScreen.storyboard @@ -1,9 +1,10 @@ - - + + + - - + + @@ -12,37 +13,75 @@ - + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - + + + + + + + + + + + + diff --git a/SoundboardQuiz/Base.lproj/Main.storyboard b/SoundboardQuiz/Base.lproj/Main.storyboard index 4b61b17..c20a2be 100644 --- a/SoundboardQuiz/Base.lproj/Main.storyboard +++ b/SoundboardQuiz/Base.lproj/Main.storyboard @@ -11,77 +11,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -116,7 +45,7 @@ - - + @@ -536,8 +474,8 @@ - - + + @@ -545,22 +483,20 @@ - - - - - - + + + + - + - + @@ -572,7 +508,7 @@ - + @@ -618,7 +554,7 @@ - + @@ -626,7 +562,7 @@ - + @@ -638,11 +574,11 @@ - + - + @@ -659,12 +595,6 @@ - - - - - - diff --git a/SoundboardQuiz/GradientView.swift b/SoundboardQuiz/GradientView.swift new file mode 100644 index 0000000..7386353 --- /dev/null +++ b/SoundboardQuiz/GradientView.swift @@ -0,0 +1,51 @@ +// *** THIS FILE WAS NOT CREATED BY ME! **** + +// GradientView.swift +// +// +// Created by Egor Sakhabaev on 23.07.17. +// Copyright © 2017 Egor Sakhabaev. All rights reserved. +// + +import UIKit + +@IBDesignable +class GradientView: UIView { + + @IBInspectable var firstColor: UIColor = UIColor.clear { + didSet { + updateView() + } + } + + @IBInspectable var secondColor: UIColor = UIColor.clear { + didSet { + updateView() + } + } + + @IBInspectable var isHorizontal: Bool = true { + didSet { + updateView() + } + } + + override class var layerClass: AnyClass { + get { + return CAGradientLayer.self + } + } + + func updateView() { + let layer = self.layer as! CAGradientLayer + layer.colors = [firstColor, secondColor].map {$0.cgColor} + if (isHorizontal) { + layer.startPoint = CGPoint(x: 0, y: 0.5) + layer.endPoint = CGPoint (x: 1, y: 0.5) + } else { + layer.startPoint = CGPoint(x: 0.5, y: 0) + layer.endPoint = CGPoint (x: 0.5, y: 1) + } + } + +}