質問編集履歴
1
tableviewの処理を追記
title
CHANGED
File without changes
|
body
CHANGED
@@ -24,4 +24,64 @@
|
|
24
24
|
}
|
25
25
|
```
|
26
26
|
画面には他にもtextfieldがあり、textfieldがタップされた時にワケあって一つ前に表示されていたのtextfieldのキーボードを閉じたいのですが、どうすればキーボードを閉じることができるでしょうか?
|
27
|
-
どなたかわかる方がいれば教えていただきたいです。よろしくお願いします。
|
27
|
+
どなたかわかる方がいれば教えていただきたいです。よろしくお願いします。
|
28
|
+
|
29
|
+
|
30
|
+
///追記///
|
31
|
+
|
32
|
+
```swift
|
33
|
+
// MARK :- UITableViewDataSource
|
34
|
+
|
35
|
+
func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
36
|
+
return self.displayCells().count
|
37
|
+
}
|
38
|
+
|
39
|
+
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
40
|
+
let id = displayCells()[indexPath.row].rawValue
|
41
|
+
let cell = tableView.dequeueReusableCell(withIdentifier: id, for: indexPath)
|
42
|
+
self.configureCell(targetCell: cell, indexPath: indexPath)
|
43
|
+
|
44
|
+
return cell
|
45
|
+
}
|
46
|
+
|
47
|
+
func configureCell(targetCell: UITableViewCell, indexPath: IndexPath) {
|
48
|
+
let type = displayCells()[indexPath.row]
|
49
|
+
|
50
|
+
switch type {
|
51
|
+
case .image:
|
52
|
+
guard let cell = targetCell as? SettingEditTableViewImageCell else {
|
53
|
+
return
|
54
|
+
}
|
55
|
+
|
56
|
+
if let image = SettingManager.sharedInstance.settings["image"]?.flatMap({$0}) {
|
57
|
+
if let imageString = image as? String {
|
58
|
+
cell.imageButton.setImage(Converter.sharedInstance.convertStringToImage(imageString: imageString), for: .normal)
|
59
|
+
}
|
60
|
+
} else {
|
61
|
+
cell.imageButton.setImage(UIImage(named: "camera"), for: .normal)
|
62
|
+
}
|
63
|
+
|
64
|
+
case .name:
|
65
|
+
if let name = SettingManager.sharedInstance.settings["name"]?.flatMap({$0}) {
|
66
|
+
if let cell = targetCell as? SettingEditTableViewTextCell {
|
67
|
+
cell.textField.text = name as? String
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
case .country:
|
72
|
+
if let country = SettingManager.sharedInstance.settings["country"]?.flatMap({$0}) {
|
73
|
+
if let cell = targetCell as? SettingEditTableViewCountryCell {
|
74
|
+
cell.countryTextField.text = country as? String
|
75
|
+
}
|
76
|
+
}
|
77
|
+
|
78
|
+
case .comment:
|
79
|
+
if let comment = SettingManager.sharedInstance.settings["comment"]?.flatMap({$0}) {
|
80
|
+
if let cell = targetCell as? SettingEditTableViewTextCell {
|
81
|
+
cell.textField.text = comment as? String
|
82
|
+
}
|
83
|
+
}
|
84
|
+
}
|
85
|
+
}
|
86
|
+
|
87
|
+
```
|