質問編集履歴
1
test
CHANGED
File without changes
|
test
CHANGED
@@ -28,8 +28,6 @@
|
|
28
28
|
|
29
29
|
var scrollView = UIScrollView()
|
30
30
|
|
31
|
-
var defaults = UserDefaults.standard
|
32
|
-
|
33
31
|
|
34
32
|
|
35
33
|
override func viewDidLoad() {
|
@@ -44,15 +42,19 @@
|
|
44
42
|
|
45
43
|
|
46
44
|
|
45
|
+
if MenuTagNo == 1 {
|
46
|
+
|
47
|
-
let picker = UIImagePickerController()
|
47
|
+
let picker = UIImagePickerController()
|
48
|
-
|
48
|
+
|
49
|
-
picker.sourceType = .photoLibrary
|
49
|
+
picker.sourceType = .photoLibrary
|
50
|
-
|
50
|
+
|
51
|
-
picker.delegate = self
|
51
|
+
picker.delegate = self
|
52
|
-
|
52
|
+
|
53
|
-
present(picker, animated: true)
|
53
|
+
present(picker, animated: true)
|
54
|
-
|
54
|
+
|
55
|
-
self.present(picker, animated: true)
|
55
|
+
self.present(picker, animated: true)
|
56
|
+
|
57
|
+
}
|
56
58
|
|
57
59
|
|
58
60
|
|
@@ -76,15 +78,9 @@
|
|
76
78
|
|
77
79
|
}
|
78
80
|
|
79
|
-
@objc func MapButtonTap(sender: UIButton) {
|
81
|
+
@objc func MapButtonTap(sender: UIButton) {
|
80
|
-
|
81
|
-
|
82
|
+
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
let storyboard: UIStoryboard = self.storyboard!
|
86
|
-
|
87
|
-
let MapVC = storyboard.instantiateViewController(withIdentifier: "Map") as! MapViewController
|
83
|
+
let MapVC = storyboard?.instantiateViewController(withIdentifier: "Map") as! MapViewController
|
88
84
|
|
89
85
|
MapVC.MapImageView = imageView
|
90
86
|
|
@@ -96,7 +92,7 @@
|
|
96
92
|
|
97
93
|
func reSetupImageView() {
|
98
94
|
|
99
|
-
|
95
|
+
self.scrollView.addSubview(imageView)
|
100
96
|
|
101
97
|
}
|
102
98
|
|
@@ -120,8 +116,6 @@
|
|
120
116
|
|
121
117
|
imageView.frame.size = CGSize(width: size.width * rate, height: size.height * rate)
|
122
118
|
|
123
|
-
// contentSize を画像サイズと同じにする
|
124
|
-
|
125
119
|
scrollView.contentSize = imageView.frame.size
|
126
120
|
|
127
121
|
}
|
@@ -140,46 +134,6 @@
|
|
140
134
|
|
141
135
|
}
|
142
136
|
|
143
|
-
|
144
|
-
|
145
|
-
// https://qiita.com/tomoyuki_HAYAKAWA/items/d9a2ccb5c76d9c276d1c
|
146
|
-
|
147
|
-
extension UserDefaults {
|
148
|
-
|
149
|
-
// 保存したいUIImage, 保存するUserDefaults, Keyを取得
|
150
|
-
|
151
|
-
func UIImageToData(image: UIImage, forKey: String) {
|
152
|
-
|
153
|
-
// UIImageをData型へ変換
|
154
|
-
|
155
|
-
let nsdata = image.pngData()
|
156
|
-
|
157
|
-
// UserDefaultsへ保存
|
158
|
-
|
159
|
-
self.set(nsdata, forKey: forKey)
|
160
|
-
|
161
|
-
}
|
162
|
-
|
163
|
-
// 参照するUserDefaults, Keyを取得, UIImageを返す
|
164
|
-
|
165
|
-
func getImageData(forKey: String) -> UIImage {
|
166
|
-
|
167
|
-
// UserDefaultsからKeyを基にData型を参照
|
168
|
-
|
169
|
-
let data = self.data(forKey: forKey)
|
170
|
-
|
171
|
-
// UIImage型へ変換
|
172
|
-
|
173
|
-
let returnImage = UIImage(data: data!)
|
174
|
-
|
175
|
-
// UIImageを返す
|
176
|
-
|
177
|
-
return returnImage!
|
178
|
-
|
179
|
-
}
|
180
|
-
|
181
|
-
}
|
182
|
-
|
183
137
|
```
|
184
138
|
|
185
139
|
|
@@ -194,10 +148,6 @@
|
|
194
148
|
|
195
149
|
let MapScrollView = UIScrollView()
|
196
150
|
|
197
|
-
var screenHeight:CGFloat!
|
198
|
-
|
199
|
-
var screenWidth:CGFloat!
|
200
|
-
|
201
151
|
|
202
152
|
|
203
153
|
override func viewDidLoad() {
|
@@ -248,13 +198,13 @@
|
|
248
198
|
|
249
199
|
@objc private func back(_ sender: Any) {
|
250
200
|
|
251
|
-
let
|
201
|
+
let mapVC = self.navigationController!
|
252
|
-
|
202
|
+
|
253
|
-
let
|
203
|
+
let scrollVC = mapVC.viewControllers[mapVC.viewControllers.count-2] as! ScrollMapViewController
|
254
|
-
|
204
|
+
|
255
|
-
|
205
|
+
scrollVC.imageView = self.MapImageView
|
256
|
-
|
206
|
+
|
257
|
-
|
207
|
+
scrollVC.reSetupImageView()
|
258
208
|
|
259
209
|
self.navigationController?.popViewController(animated: true)
|
260
210
|
|