131 lines
4.4 KiB
Swift
131 lines
4.4 KiB
Swift
//
|
|
// settingsViewController.swift
|
|
// Guibe
|
|
//
|
|
// Created by Max Hunt on 30/05/2019.
|
|
// Copyright © 2019 8. All rights reserved.
|
|
//
|
|
|
|
import UIKit
|
|
|
|
class settingsViewController: UIViewController {
|
|
let defaults = UserDefaults.standard
|
|
|
|
// OUTLETS--------------OUTLETS
|
|
@IBOutlet weak var cLeft: UIImageView!
|
|
@IBOutlet weak var cRight: UIImageView!
|
|
@IBOutlet weak var cBTop: UIImageView!
|
|
@IBOutlet weak var CSTop: UIImageView!
|
|
@IBOutlet weak var backBtn: UIButton!
|
|
|
|
@IBOutlet weak var leftBtn: UIButton!
|
|
@IBOutlet weak var rightBtn: UIButton!
|
|
@IBOutlet weak var bTopBtn: UIButton!
|
|
@IBOutlet weak var sTopBtn: UIButton!
|
|
|
|
@IBOutlet weak var sideText: UITextView!
|
|
@IBOutlet weak var teoSideText: UITextView!
|
|
|
|
@IBOutlet weak var titleLbl: UILabel!
|
|
@IBOutlet var v1ew: UIView!
|
|
@IBOutlet weak var l1: UILabel!
|
|
@IBOutlet weak var l2: UILabel!
|
|
@IBOutlet weak var l3: UILabel!
|
|
@IBOutlet weak var l4: UILabel!
|
|
// OUTLETS--------------OUTLETS
|
|
|
|
|
|
// ACTIONS--------------ACTIONS
|
|
@IBAction func backBtnPressed(_ sender: Any) {
|
|
self.dismiss(animated: true, completion: nil)
|
|
}
|
|
@IBAction func leftBtnPressed(_ sender: Any) {
|
|
if defaults.integer(forKey: "handSide") == 2{
|
|
defaults.set(1, forKey: "handSide")
|
|
UIView.animate(withDuration: 0.4, animations: {self.cLeft.alpha = 1.0})
|
|
UIView.animate(withDuration: 0.4, animations: {self.cRight.alpha = 0.0})
|
|
}
|
|
}
|
|
@IBAction func rightBtnPressed(_ sender: Any) {
|
|
if defaults.integer(forKey: "handSide") == 1{
|
|
defaults.set(2, forKey: "handSide")
|
|
UIView.animate(withDuration: 0.4, animations: {self.cLeft.alpha = 0.0})
|
|
UIView.animate(withDuration: 0.4, animations: {self.cRight.alpha = 1.0})
|
|
}
|
|
}
|
|
@IBAction func bTopBtnPressed(_ sender: Any) {
|
|
if defaults.integer(forKey: "bigSide") == 2{
|
|
defaults.set(1, forKey: "bigSide")
|
|
UIView.animate(withDuration: 0.4, animations: {self.cBTop.alpha = 1.0})
|
|
UIView.animate(withDuration: 0.4, animations: {self.CSTop.alpha = 0.0})
|
|
}
|
|
}
|
|
@IBAction func sTopBtnPressed(_ sender: Any) {
|
|
if defaults.integer(forKey: "bigSide") == 1{
|
|
defaults.set(2, forKey: "bigSide")
|
|
UIView.animate(withDuration: 0.4, animations: {self.cBTop.alpha = 0.0})
|
|
UIView.animate(withDuration: 0.4, animations: {self.CSTop.alpha = 1.0})
|
|
}
|
|
}
|
|
|
|
|
|
// ACTIONS--------------ACTIONS
|
|
override func viewDidLoad() {
|
|
super.viewDidLoad()
|
|
v1ew.backgroundColor = UIColor.systemBackground
|
|
titleLbl.textColor = UIColor.label
|
|
sideText.textColor = UIColor.secondaryLabel
|
|
teoSideText.textColor = UIColor.secondaryLabel
|
|
// l1.textColor =
|
|
|
|
|
|
switch defaults.integer(forKey: "handSide") {
|
|
case 1:
|
|
cLeft.alpha = 1.0
|
|
cRight.alpha = 0.0
|
|
case 2:
|
|
cLeft.alpha = 0.0
|
|
cRight.alpha = 1.0
|
|
default:
|
|
print("ERROR, THIS CANNOT HAPPEN!!!!!")
|
|
}
|
|
|
|
switch defaults.integer(forKey: "bigSide") {
|
|
case 1:
|
|
cBTop.alpha = 1.0
|
|
CSTop.alpha = 0.0
|
|
case 2:
|
|
cBTop.alpha = 0.0
|
|
CSTop.alpha = 1.0
|
|
default:
|
|
print("ERROR, THIS CANNOT HAPPEN!!!!!")
|
|
}
|
|
|
|
backBtn.accessibilityLabel = "Back"
|
|
cLeft.accessibilityLabel = "Left hand"
|
|
leftBtn.accessibilityLabel = "Left hand"
|
|
cRight.accessibilityLabel = "Right hand"
|
|
rightBtn.accessibilityLabel = "Right hand"
|
|
cBTop.accessibilityLabel = "Big side on top"
|
|
bTopBtn.accessibilityLabel = "Big side on top"
|
|
CSTop.accessibilityLabel = "Small side on top"
|
|
sTopBtn.accessibilityLabel = "Small side on top"
|
|
sideText.accessibilityLabel = "Where would you like to wear ghibe"
|
|
teoSideText.accessibilityLabel = "How would you like to wear ghibe?"
|
|
|
|
|
|
}
|
|
|
|
|
|
/*
|
|
// MARK: - Navigation
|
|
|
|
// In a storyboard-based application, you will often want to do a little preparation before navigation
|
|
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
|
|
// Get the new view controller using segue.destination.
|
|
// Pass the selected object to the new view controller.
|
|
}
|
|
*/
|
|
|
|
}
|