-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSettingsVC.swift
More file actions
60 lines (48 loc) · 1.8 KB
/
SettingsVC.swift
File metadata and controls
60 lines (48 loc) · 1.8 KB
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
50
51
52
53
54
55
56
57
58
59
60
//
// SettingsVC.swift
// project-mars
//
// Created by Aleksandr Grin on 12/8/16.
// Copyright © 2016 AleksandrGrin. All rights reserved.
//
import UIKit
import SpriteKit
class SettingsVC: UIViewController {
@IBOutlet weak var ScrollView: SettingsView!
override func viewWillAppear(_ animated: Bool) {
super.viewWillAppear(animated)
self.view.setMainBackgroundwithFit(backgroundName: "Main_BG_final.png")
ScrollView.setSettingsStyle(named: "Label_BG_final2.png")
if ScrollView.settingsSelected == nil{
do{ ScrollView.settingsSelected = try gameState.sharedInstance().GameSettings } catch { print("Error in SettingsVC viewwillappear") }
ScrollView.pushUserSettings()
}
ScrollView.initSettingsViews()
}
override func viewDidLoad() {
super.viewDidLoad()
if UIScreen.main.bounds.height < 600 {
ScrollView.contentSize.height = 700
}else{
ScrollView.contentSize.height = UIScreen.main.bounds.height
}
ScrollView.contentSize.width = UIScreen.main.bounds.width
ScrollView.isUserInteractionEnabled = true
}
override var shouldAutorotate: Bool {
return true
}
override var supportedInterfaceOrientations: UIInterfaceOrientationMask {
if UIDevice.current.userInterfaceIdiom == .phone {
return .allButUpsideDown
} else {
return .all
}
}
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "returnToMenu" {
ScrollView.saveUserSettings()
do { try gameState.sharedInstance().GameSettings = ScrollView.settingsSelected } catch { print("Error in settingsVC prepare") }
}
}
}