質問編集履歴
3
構造体を追加しそれに伴う編集をしました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -38,18 +38,44 @@
|
|
38
38
|
|
39
39
|
|
40
40
|
|
41
|
-
*********************************
|
41
|
+
*********************************
|
42
42
|
|
43
43
|
6/15 2:20~
|
44
44
|
|
45
45
|
新しくコードを編集いたしました!
|
46
46
|
|
47
|
-
|
47
|
+
*********************************
|
48
|
+
|
49
|
+
6/15 17:30~
|
50
|
+
|
51
|
+
新しく構造体で辞書型key値を作成。コードを追加&編集いたしました!
|
48
52
|
|
49
53
|
|
50
54
|
|
51
55
|
![イメージ説明](cc04787671f67e75b593b753aa381410.jpeg) ![イメージ説明](407ba22df45f19b9af305914b64d6d15.jpeg)
|
52
56
|
|
57
|
+
|
58
|
+
|
59
|
+
```
|
60
|
+
|
61
|
+
****追加しました 6/15 17:30~****
|
62
|
+
|
63
|
+
struct D {
|
64
|
+
|
65
|
+
static let date = "date"
|
66
|
+
|
67
|
+
static let startTime = "startTime"
|
68
|
+
|
69
|
+
static let endTime = "endTime"
|
70
|
+
|
71
|
+
static let projectTitle = "projectTitle"
|
72
|
+
|
73
|
+
******************
|
74
|
+
|
75
|
+
}
|
76
|
+
|
77
|
+
```
|
78
|
+
|
53
79
|
```
|
54
80
|
|
55
81
|
|
@@ -68,7 +94,7 @@
|
|
68
94
|
|
69
95
|
class CalendarViewController: UIViewController{
|
70
96
|
|
71
|
-
****新しく定義しなおしました****
|
97
|
+
****新しく定義しなおしました 6/15 2:20~****
|
72
98
|
|
73
99
|
var editDic : [[String:String]] = [[:]]
|
74
100
|
|
@@ -124,9 +150,9 @@
|
|
124
150
|
|
125
151
|
|
126
152
|
|
127
|
-
****新しく定義しなおしました****
|
153
|
+
****新しく定義しなおしました 6/15 2:20~****
|
128
|
-
|
154
|
+
|
129
|
-
editDic.append([
|
155
|
+
editDic.append([D.date:schedulingDate])
|
130
156
|
|
131
157
|
|
132
158
|
|
@@ -154,7 +180,7 @@
|
|
154
180
|
|
155
181
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
156
182
|
|
157
|
-
****新しく定義しなおしました****
|
183
|
+
****新しく定義しなおしました 6/15 2:20~****
|
158
184
|
|
159
185
|
return editDic.count
|
160
186
|
|
@@ -166,25 +192,25 @@
|
|
166
192
|
|
167
193
|
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
|
168
194
|
|
169
|
-
cell.textLabel!.text = editDic[indexPath.row][
|
195
|
+
cell.textLabel!.text = editDic[indexPath.row][D.date] ?? ""
|
170
|
-
|
196
|
+
|
171
|
-
****新しく定義しなおしました****
|
197
|
+
****新しく定義しなおしました 6/15 2:20~****
|
172
198
|
|
173
199
|
let jobTitleLabel = cell.viewWithTag(1) as! UILabel
|
174
200
|
|
175
|
-
jobTitleLabel.text = editDic[indexPath][
|
201
|
+
jobTitleLabel.text = editDic[indexPath][D.projectTitle] ?? ""
|
176
202
|
|
177
203
|
|
178
204
|
|
179
205
|
let startTimeLabel = cell.viewWithTag(2) as! UILabel
|
180
206
|
|
181
|
-
startTimeLabel.text = editDic[indexPath][
|
207
|
+
startTimeLabel.text = editDic[indexPath][D.startTime] ?? ""
|
182
208
|
|
183
209
|
|
184
210
|
|
185
211
|
let endTimeLabel = cell.viewWithTag(3) as! UILabel
|
186
212
|
|
187
|
-
endTimeLabel.text = editDic[indexPath][
|
213
|
+
endTimeLabel.text = editDic[indexPath][D.endTime] ?? ""
|
188
214
|
|
189
215
|
*****************************
|
190
216
|
|
@@ -198,9 +224,9 @@
|
|
198
224
|
|
199
225
|
let nextVC = storyboard?.instantiateViewController(identifier: "ItemsForLocationsViewController") as! ItemsForLocationsViewController
|
200
226
|
|
201
|
-
****新しく定義しなおしました****
|
227
|
+
****新しく定義しなおしました 6/15 2:20~****
|
202
|
-
|
228
|
+
|
203
|
-
nextVC.editDic = editDic[indexPath.row][
|
229
|
+
nextVC.editDic = editDic[indexPath.row][D.date]
|
204
230
|
|
205
231
|
selectedRow = indexPath.row
|
206
232
|
|
@@ -234,11 +260,11 @@
|
|
234
260
|
|
235
261
|
class ItemsForLocationsViewController: UIViewController{
|
236
262
|
|
237
|
-
****新しく定義しなおしました****
|
263
|
+
****新しく定義しなおしました 6/15 2:20~****
|
238
|
-
|
264
|
+
|
239
|
-
var start = String()
|
265
|
+
var startTime = String()
|
240
|
-
|
266
|
+
|
241
|
-
var end = String()
|
267
|
+
var endTime = String()
|
242
268
|
|
243
269
|
var selectedNum = 0
|
244
270
|
|
@@ -272,13 +298,13 @@
|
|
272
298
|
|
273
299
|
let previousVC = preNC.viewControllers[preNC.viewControllers.count - 2] as! CalendarViewController
|
274
300
|
|
275
|
-
****新しく定義しなおしました****
|
301
|
+
****新しく定義しなおしました 6/15 2:20~****
|
276
|
-
|
302
|
+
|
277
|
-
editDic[selectedNum][
|
303
|
+
editDic[selectedNum][D.projectTitle] = projectTitle
|
278
|
-
|
304
|
+
|
279
|
-
editDic[selectedNum][
|
305
|
+
editDic[selectedNum][D.startTime] = startTime
|
280
|
-
|
306
|
+
|
281
|
-
editDic[selectedNum][
|
307
|
+
editDic[selectedNum][D.endTime] = endTime
|
282
308
|
|
283
309
|
previousVC.editDic = editDic
|
284
310
|
|
2
誤字がありました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -126,7 +126,7 @@
|
|
126
126
|
|
127
127
|
****新しく定義しなおしました****
|
128
128
|
|
129
|
-
editDic.append(["
|
129
|
+
editDic.append(["date":schedulingDate])
|
130
130
|
|
131
131
|
|
132
132
|
|
@@ -166,7 +166,7 @@
|
|
166
166
|
|
167
167
|
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
|
168
168
|
|
169
|
-
cell.textLabel!.text = editDic[indexPath.row]["
|
169
|
+
cell.textLabel!.text = editDic[indexPath.row]["date"] ?? ""
|
170
170
|
|
171
171
|
****新しく定義しなおしました****
|
172
172
|
|
@@ -200,7 +200,7 @@
|
|
200
200
|
|
201
201
|
****新しく定義しなおしました****
|
202
202
|
|
203
|
-
nextVC.editDic = editDic[indexPath.row]["
|
203
|
+
nextVC.editDic = editDic[indexPath.row]["date"]
|
204
204
|
|
205
205
|
selectedRow = indexPath.row
|
206
206
|
|
@@ -240,6 +240,8 @@
|
|
240
240
|
|
241
241
|
var end = String()
|
242
242
|
|
243
|
+
var selectedNum = 0
|
244
|
+
|
243
245
|
var editDic : [[String:String]] = [[:]]
|
244
246
|
|
245
247
|
|
1
ViewController,NextViewController共にcodeの変更を行いました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,6 +36,18 @@
|
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
+
|
40
|
+
|
41
|
+
**********************************************************
|
42
|
+
|
43
|
+
6/15 2:20~
|
44
|
+
|
45
|
+
新しくコードを編集いたしました!
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
|
39
51
|
![イメージ説明](cc04787671f67e75b593b753aa381410.jpeg) ![イメージ説明](407ba22df45f19b9af305914b64d6d15.jpeg)
|
40
52
|
|
41
53
|
```
|
@@ -56,26 +68,18 @@
|
|
56
68
|
|
57
69
|
class CalendarViewController: UIViewController{
|
58
70
|
|
59
|
-
|
71
|
+
****新しく定義しなおしました****
|
60
|
-
|
72
|
+
|
61
|
-
var edit
|
73
|
+
var editDic : [[String:String]] = [[:]]
|
62
|
-
|
74
|
+
|
63
|
-
var
|
75
|
+
var selectedRow = 0
|
64
|
-
|
65
|
-
|
66
|
-
|
76
|
+
|
67
|
-
|
77
|
+
****************************
|
68
|
-
|
69
|
-
var endding = ""
|
70
|
-
|
71
|
-
|
72
78
|
|
73
79
|
override func viewDidLoad() {
|
74
80
|
|
75
81
|
super.viewDidLoad()
|
76
82
|
|
77
|
-
|
78
|
-
|
79
83
|
)
|
80
84
|
|
81
85
|
|
@@ -118,9 +122,11 @@
|
|
118
122
|
|
119
123
|
let schedulingDate = "(month)月(day)日 ((call))"
|
120
124
|
|
125
|
+
|
126
|
+
|
121
|
-
|
127
|
+
****新しく定義しなおしました****
|
122
|
-
|
128
|
+
|
123
|
-
d
|
129
|
+
editDic.append(["Key":schedulingDate])
|
124
130
|
|
125
131
|
|
126
132
|
|
@@ -148,13 +154,9 @@
|
|
148
154
|
|
149
155
|
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
150
156
|
|
157
|
+
****新しく定義しなおしました****
|
158
|
+
|
151
|
-
return d
|
159
|
+
return editDic.count
|
152
|
-
|
153
|
-
}
|
154
|
-
|
155
|
-
func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat {
|
156
|
-
|
157
|
-
return 64
|
158
160
|
|
159
161
|
}
|
160
162
|
|
@@ -164,280 +166,126 @@
|
|
164
166
|
|
165
167
|
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath)
|
166
168
|
|
167
|
-
cell.textLabel!.text = d
|
169
|
+
cell.textLabel!.text = editDic[indexPath.row]["key"] ?? ""
|
168
|
-
|
169
|
-
|
170
|
-
|
170
|
+
|
171
|
-
|
171
|
+
****新しく定義しなおしました****
|
172
172
|
|
173
173
|
let jobTitleLabel = cell.viewWithTag(1) as! UILabel
|
174
174
|
|
175
|
+
jobTitleLabel.text = editDic[indexPath]["title"] ?? ""
|
176
|
+
|
175
177
|
|
176
178
|
|
177
|
-
|
178
|
-
|
179
179
|
let startTimeLabel = cell.viewWithTag(2) as! UILabel
|
180
180
|
|
181
|
-
|
181
|
+
startTimeLabel.text = editDic[indexPath]["start"] ?? ""
|
182
182
|
|
183
183
|
|
184
184
|
|
185
185
|
let endTimeLabel = cell.viewWithTag(3) as! UILabel
|
186
186
|
|
187
|
+
endTimeLabel.text = editDic[indexPath]["end"] ?? ""
|
188
|
+
|
189
|
+
*****************************
|
190
|
+
|
191
|
+
return cell
|
192
|
+
|
193
|
+
}
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
|
198
|
+
|
199
|
+
let nextVC = storyboard?.instantiateViewController(identifier: "ItemsForLocationsViewController") as! ItemsForLocationsViewController
|
200
|
+
|
201
|
+
****新しく定義しなおしました****
|
202
|
+
|
203
|
+
nextVC.editDic = editDic[indexPath.row]["key"]
|
204
|
+
|
205
|
+
selectedRow = indexPath.row
|
206
|
+
|
207
|
+
nextVC.selectedNum = selectedRow
|
208
|
+
|
209
|
+
****************************
|
210
|
+
|
211
|
+
navigationController?.pushViewController(nextVC, animated: true)
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
}
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
}
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
```
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
NextViewController
|
228
|
+
|
229
|
+
```
|
230
|
+
|
231
|
+
import UIKit
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
class ItemsForLocationsViewController: UIViewController{
|
236
|
+
|
237
|
+
****新しく定義しなおしました****
|
238
|
+
|
239
|
+
var start = String()
|
240
|
+
|
241
|
+
var end = String()
|
242
|
+
|
243
|
+
var editDic : [[String:String]] = [[:]]
|
244
|
+
|
245
|
+
|
246
|
+
|
247
|
+
---略---
|
248
|
+
|
249
|
+
|
250
|
+
|
251
|
+
override func viewDidLoad() {
|
252
|
+
|
253
|
+
super.viewDidLoad()
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
}
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
@IBAction func savingDate(_ sender: UIBarButtonItem) {
|
262
|
+
|
263
|
+
|
264
|
+
|
265
|
+
guard let projectTitle = projectNameLabel.text else { return }
|
266
|
+
|
187
267
|
|
188
268
|
|
189
|
-
|
190
|
-
|
191
|
-
return cell
|
192
|
-
|
193
|
-
}
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
269
|
+
let preNC = self.navigationController!
|
198
|
-
|
270
|
+
|
199
|
-
|
271
|
+
let previousVC = preNC.viewControllers[preNC.viewControllers.count - 2] as! CalendarViewController
|
272
|
+
|
200
|
-
|
273
|
+
****新しく定義しなおしました****
|
274
|
+
|
275
|
+
editDic[selectedNum]["title"] = projectTitle
|
276
|
+
|
201
|
-
|
277
|
+
editDic[selectedNum]["start"] = startTime
|
278
|
+
|
202
|
-
|
279
|
+
editDic[selectedNum]["end"] = endTime
|
280
|
+
|
281
|
+
previousVC.editDic = editDic
|
282
|
+
|
283
|
+
|
284
|
+
|
203
|
-
navigationController?.p
|
285
|
+
self.navigationController?.popViewController(animated: true)
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
}
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
}
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
```
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
NextViewController
|
220
|
-
|
221
|
-
```
|
222
|
-
|
223
|
-
import UIKit
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
class ItemsForLocationsViewController: UIViewController{
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
struct Infos {
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
let date:String
|
238
|
-
|
239
|
-
let startTime : String
|
240
|
-
|
241
|
-
let endTime : String
|
242
|
-
|
243
|
-
let projectTitle : String
|
244
|
-
|
245
|
-
let postalNum : String
|
246
|
-
|
247
|
-
let address: String
|
248
|
-
|
249
|
-
let building: String
|
250
|
-
|
251
|
-
let spot: String
|
252
|
-
|
253
|
-
let items: String
|
254
|
-
|
255
|
-
let remarks: String
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
init(date:String,
|
260
|
-
|
261
|
-
startTime:String,
|
262
|
-
|
263
|
-
endTime:String,
|
264
|
-
|
265
|
-
projectTitle:String,
|
266
|
-
|
267
|
-
postalNum:String,
|
268
|
-
|
269
|
-
address:String,
|
270
|
-
|
271
|
-
building:String,
|
272
|
-
|
273
|
-
spot:String,
|
274
|
-
|
275
|
-
items:String,
|
276
|
-
|
277
|
-
remarks:String){
|
278
|
-
|
279
|
-
|
280
|
-
|
281
|
-
self.date = date
|
282
|
-
|
283
|
-
self.startTime = startTime
|
284
|
-
|
285
|
-
self.endTime = endTime
|
286
|
-
|
287
|
-
self.projectTitle = projectTitle
|
288
|
-
|
289
|
-
self.postalNum = postalNum
|
290
|
-
|
291
|
-
self.address = address
|
292
|
-
|
293
|
-
self.building = building
|
294
|
-
|
295
|
-
self.spot = spot
|
296
|
-
|
297
|
-
self.items = items
|
298
|
-
|
299
|
-
self.remarks = remarks
|
300
|
-
|
301
|
-
}
|
302
286
|
|
303
287
|
}
|
304
288
|
|
305
|
-
|
306
|
-
|
307
|
-
|
308
|
-
|
309
|
-
var editArray = [Infos]()
|
310
|
-
|
311
|
-
var selectedArray = [String]()
|
312
|
-
|
313
|
-
var dateLabelFromPrevious = String()
|
314
|
-
|
315
|
-
let userDefaluts = UserDefaults.standard
|
316
|
-
|
317
|
-
|
318
|
-
|
319
|
-
/****picker****/
|
320
|
-
|
321
|
-
@IBOutlet weak var startTimePickerView: UIPickerView!
|
322
|
-
|
323
|
-
@IBOutlet weak var endTimePickerView: UIPickerView!
|
324
|
-
|
325
|
-
/****View****/
|
326
|
-
|
327
|
-
@IBOutlet weak var timeLabelView: UIView!
|
328
|
-
|
329
|
-
@IBOutlet weak var projectLabelView: UIView!
|
330
|
-
|
331
|
-
@IBOutlet weak var addressLabelView: UIView!
|
332
|
-
|
333
|
-
@IBOutlet weak var itemLabelView: UIView!
|
334
|
-
|
335
|
-
@IBOutlet weak var remarkLabelView: UIView!
|
336
|
-
|
337
|
-
/****各ラベル****/
|
338
|
-
|
339
|
-
@IBOutlet weak var dateLabel: UILabel!
|
340
|
-
|
341
|
-
@IBOutlet weak var projectNameLabel: UITextField!
|
342
|
-
|
343
|
-
@IBOutlet weak var postalNumLabel: UITextField!
|
344
|
-
|
345
|
-
@IBOutlet weak var addressLabel: UITextField!
|
346
|
-
|
347
|
-
@IBOutlet weak var nameOfBuildingLabel: UITextField!
|
348
|
-
|
349
|
-
@IBOutlet weak var exactPlaceLabel: UITextField!
|
350
|
-
|
351
|
-
@IBOutlet weak var appearanceTextView: UITextView!
|
352
|
-
|
353
|
-
@IBOutlet weak var remarksColumnTextView: UITextView!
|
354
|
-
|
355
|
-
@IBOutlet weak var scrollView: UIScrollView!
|
356
|
-
|
357
|
-
|
358
|
-
|
359
|
-
override func viewDidLoad() {
|
360
|
-
|
361
|
-
super.viewDidLoad()
|
362
|
-
|
363
|
-
|
364
|
-
|
365
|
-
/****日付****/
|
366
|
-
|
367
|
-
dateLabel.text = dateLabelFromPrevious
|
368
|
-
|
369
|
-
navigationController?.delegate = self
|
370
|
-
|
371
|
-
appearanceTextView.delegate = self
|
372
|
-
|
373
|
-
remarksColumnTextView.delegate = self
|
374
|
-
|
375
|
-
startTimePickerView.delegate = self
|
376
|
-
|
377
|
-
startTimePickerView.dataSource = self
|
378
|
-
|
379
|
-
endTimePickerView.delegate = self
|
380
|
-
|
381
|
-
endTimePickerView.dataSource = self
|
382
|
-
|
383
|
-
}
|
384
|
-
|
385
|
-
|
386
|
-
|
387
|
-
@IBAction func savingDate(_ sender: UIBarButtonItem) {
|
388
|
-
|
389
|
-
|
390
|
-
|
391
|
-
guard let projectTitle = projectNameLabel.text else { return }
|
392
|
-
|
393
|
-
guard let postalNum = postalNumLabel.text else { return }
|
394
|
-
|
395
|
-
guard let address = addressLabel.text else { return }
|
396
|
-
|
397
|
-
guard let building = nameOfBuildingLabel.text else { return }
|
398
|
-
|
399
|
-
guard let spot = exactPlaceLabel.text else { return }
|
400
|
-
|
401
|
-
guard let items = appearanceTextView.text else { return }
|
402
|
-
|
403
|
-
guard let remarks = remarksColumnTextView.text else { return }
|
404
|
-
|
405
|
-
|
406
|
-
|
407
|
-
//今まではこちらで値を渡してました。
|
408
|
-
|
409
|
-
//let preNC = self.navigationController!
|
410
|
-
|
411
|
-
//let previousVC = preNC.viewControllers[preNC.viewControllers.count - 2] as!
|
412
|
-
|
413
|
-
CalendarViewController
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
editArray.append(Infos(date: dateLabelFromPrevious, startTime: startTime, endTime: endTime, projectTitle: projectTitle, postalNum: postalNum, address: address ,building: building, spot: spot, items:items, remarks: remarks ))
|
418
|
-
|
419
|
-
print(editArray)
|
420
|
-
|
421
|
-
|
422
|
-
|
423
|
-
//ここでエラーがおきます
|
424
|
-
|
425
|
-
userDefaluts.set(editArray,forKey: "data")
|
426
|
-
|
427
|
-
|
428
|
-
|
429
|
-
//今まではこちらで値を渡してました。
|
430
|
-
|
431
|
-
//previousVC.editArray = editArray
|
432
|
-
|
433
|
-
//previousVC.beginning = startTime
|
434
|
-
|
435
|
-
//previousVC.endding = endTime
|
436
|
-
|
437
|
-
self.navigationController?.popViewController(animated: true)
|
438
|
-
|
439
|
-
}
|
440
|
-
|
441
289
|
}
|
442
290
|
|
443
291
|
|