質問編集履歴

2

コードの追加

2020/04/11 02:05

投稿

nishimu
nishimu

スコア26

test CHANGED
File without changes
test CHANGED
@@ -104,37 +104,63 @@
104
104
 
105
105
 
106
106
 
107
- //alertbuttonを押したときの処理
107
+ func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
108
108
 
109
+ tableView.deselectRow(at: indexPath, animated: true)
110
+
111
+ let currentHR = displayimageNames[indexPath.row]
112
+
113
+ let alert: UIAlertController = UIAlertController(title: "(currentHR)の待ち時間を更新", message: "現在の待ち時間を入力してください", preferredStyle: UIAlertController.Style.alert)
114
+
115
+
116
+
117
+ let defaultAction: UIAlertAction = UIAlertAction(title: "更新", style: UIAlertAction.Style.default, handler:{
118
+
119
+
120
+
121
+ (action: UIAlertAction!) -> Void in
122
+
123
+
124
+
109
- if let waitTime = alert.textFields?.first?.text {
125
+ if let waitTime = alert.textFields?.first?.text {
110
126
 
111
127
 
112
128
 
113
- let newContains = Contains(waitTime: waitTime, timeStamp: Date())
129
+ let newContains = Contains(waitTime: waitTime, timeStamp: Date())
114
130
 
115
131
 
116
132
 
117
- // Add a new document with a generated ID
133
+ // Add a new document with a generated ID
118
134
 
119
- var ref: DocumentReference? = nil
135
+ var ref: DocumentReference? = nil
120
136
 
121
-  //error箇所
137
+ ref = self.db.collection("HR").document("(currentHR)").setData(newContains.dictionary
122
138
 
123
-  ref = self.db.collection("HR").document("currentHR").setData(newContains.dictionary ){ err in
139
+ ){ err in
124
140
 
125
141
 
126
142
 
127
- if let err = err {
143
+ if let err = err {
128
144
 
129
- print("Error adding document: (err)")
145
+ print("Error adding document: (err)")
130
146
 
131
- } else {
147
+ } else {
132
148
 
133
- print("Document added with ID: (ref!.documentID)")
149
+ print("Document added with ID: (ref!.documentID)")
134
150
 
135
- }
151
+ }
136
152
 
137
- }
153
+ }
154
+
155
+
156
+
157
+ }
158
+
159
+
160
+
161
+ print("更新")
162
+
163
+ })
138
164
 
139
165
  ```
140
166
 

1

タイトルの変更

2020/04/11 02:05

投稿

nishimu
nishimu

スコア26

test CHANGED
@@ -1 +1 @@
1
- Document IDを指定できない
1
+ 【CloudFireStore】Document IDを指定できない
test CHANGED
File without changes