Contents

(后注,一个GalGame的保存界面

IB的垃圾引用,fuck me

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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
//
// SaveViewController.swift
// Yzk
//
// Created by 极黑的夏纳 on 16/1/4.
// Copyright © 2016年 xana. All rights reserved.
//
import UIKit
// tofix:
var saves: [Int?] = [nil, nil, nil, nil];
class SaveViewController: UIViewController, UIPopoverPresentationControllerDelegate {
@IBOutlet weak var saveText1: UITextView!
@IBOutlet weak var saveText2: UITextView!
@IBOutlet weak var saveText3: UITextView!
@IBOutlet weak var saveText4: UITextView!
@IBOutlet weak var saveImageView1: UIImageView!
@IBOutlet weak var saveImageView2: UIImageView!
@IBOutlet weak var saveImageView3: UIImageView!
@IBOutlet weak var saveImageView4: UIImageView!
// private var saveImage1: UIImage? {
// get { return saveImageView1.image }
// set { saveImageView1.image = newValue }
// }
// private var saveImage2: UIImage? {
// get { return saveImageView2.image }
// set { saveImageView2.image = newValue }
// }
// private var saveImage3: UIImage? {
// get { return saveImageView3.image }
// set { saveImageView3.image = newValue }
// }
// private var saveImage4: UIImage? {
// get { return saveImageView4.image }
// set { saveImageView4.image = newValue }
// }
// var SaveViewDatas: [[String: AnyObject?]] = [];
// todo:
// private let defaults = NSUserDefaults.standardUserDefaults()
override func viewDidLoad() {
// SaveViewDatas = [
// ["img": saveImageView1.image,"text": saveText1.text,],
// ["img": saveImageView2.image,"text": saveText2.text,],
// ["img": saveImageView3.image,"text": saveText3.text,],
// ["img": saveImageView4.image,"text": saveText4.text,],
// ]
saveText1.addGestureRecognizer(TGR("save1"))
saveText2.addGestureRecognizer(TGR("save2"))
saveText3.addGestureRecognizer(TGR("save3"))
saveText4.addGestureRecognizer(TGR("save4"))
unwrapAll()
}
func TGR(name:String) -> UITapGestureRecognizer {
return UITapGestureRecognizer(target: self, action: Selector(name))
}
// func unwrap() {
// for i in 0...3 {
//
// var views = SaveViewDatas[i]
//
// if let num = saves[i] { // every savePoint
//
// let source = data[num]
//
// if let bgStr = source["bg"] {
//
// print(UIImage(named: bgStr))
// print(views["img"]!)
// views["img"]! = UIImage(named: bgStr)
// //saveImage1 = UIImage(named: bgStr)
// print(saveImage1)
// print(views["img"]!)
// }
//
// if let words = source["words"] {
//
// print(words)
// print(views["text"])
// print(views["text"]!)
// print(views["text"]!!)
// views["text"]!! = words
// print(words)
// print(views["text"])
// print(views["text"]!)
// print(views["text"]!!)
// }
//
// } else {
// //print("\(index) is nil.\n");
// }
// }
// }
func unwrapAll() {
unwrap1()
unwrap2()
unwrap3()
unwrap4()
}
func unwrap1(){
if let n = saves[0] {
let source1 = data[n]
if let bgStr = source1["bg"] {
saveImageView1.image = UIImage(named: bgStr)
}
if let words = source1["words"] {
saveText1.text = words
}
}
}
func unwrap2(){
if let n = saves[1] {
let source2 = data[n]
if let bgStr = source2["bg"] {
saveImageView2.image = UIImage(named: bgStr)
}
if let words = source2["words"] {
saveText2.text = words
}
}
}
func unwrap3(){
if let n = saves[2] {
let source3 = data[n]
if let bgStr = source3["bg"] {
saveImageView3.image = UIImage(named: bgStr)
}
if let words = source3["words"] {
saveText3.text = words
}
}
}
func unwrap4(){
if let n = saves[3] {
let source4 = data[n]
if let bgStr = source4["bg"] {
saveImageView4.image = UIImage(named: bgStr)
}
if let words = source4["words"] {
saveText4.text = words
}
}
}
func save1(){
saves[0] = number
unwrap1()
}
func save2(){
saves[1] = number
unwrap2()
}
func save3(){
saves[2] = number
unwrap3()
}
func save4(){
saves[3] = number
unwrap4()
}
}

(后后注,听说你们要看图?前方高能预警

title

title

title

Contents