質問編集履歴
4
コード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -218,7 +218,7 @@
|
|
218
218
|
|
219
219
|
let aLabel = table.viewWithTag(100) as! UILabel
|
220
220
|
|
221
|
-
aLabel.text = "\(self.appDelegate.
|
221
|
+
aLabel.text = "\(self.appDelegate.xAR[indexPath.row])"
|
222
222
|
|
223
223
|
|
224
224
|
|
3
不要で紛らわしいコメントアウト修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -194,8 +194,6 @@
|
|
194
194
|
|
195
195
|
|
196
196
|
|
197
|
-
//let singer = appDelegate.singerList
|
198
|
-
|
199
197
|
return self.appDelegate.xAR.count
|
200
198
|
|
201
199
|
}
|
2
画面遷移元 cellタップ時のコード 画面遷移後のコードを追加しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -10,6 +10,18 @@
|
|
10
10
|
|
11
11
|
|
12
12
|
|
13
|
+
追記
|
14
|
+
|
15
|
+
元tableviewのcellをタップ→storyboard上でe.g.pushにて次tableviewに遷移
|
16
|
+
|
17
|
+
そしてtableviewcellに描画
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
この流れの今元tableviewのcellをタップでAPIの結果をe.g.push前に欲しいのですがe.g.push後にAPIの結果が返ってきます。
|
22
|
+
|
23
|
+
|
24
|
+
|
13
25
|
###発生している問題・エラーメッセージ
|
14
26
|
|
15
27
|
エラーはありません、非同期処理でAPIの結果を待つ処理を行いたです。
|
@@ -24,7 +36,9 @@
|
|
24
36
|
|
25
37
|
###該当のソースコード
|
26
38
|
|
27
|
-
Swift3
|
39
|
+
Swift3 元tableviewのcellがタップされたとき
|
40
|
+
|
41
|
+
画面遷移はstoryboard上で実装
|
28
42
|
|
29
43
|
|
30
44
|
|
@@ -132,6 +146,102 @@
|
|
132
146
|
|
133
147
|
|
134
148
|
|
149
|
+
以下画面遷移先のコード
|
150
|
+
|
151
|
+
|
152
|
+
|
153
|
+
```ここに言語を入力
|
154
|
+
|
155
|
+
import UIKit
|
156
|
+
|
157
|
+
import SwiftyJSON
|
158
|
+
|
159
|
+
import Alamofire
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
class aTableViewController: UITableViewController{
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
var selectedInfo : String?
|
168
|
+
|
169
|
+
var urlString: String?
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
|
175
|
+
override func viewDidLoad() {
|
176
|
+
|
177
|
+
super.viewDidLoad()
|
178
|
+
|
179
|
+
|
180
|
+
|
181
|
+
tableView.rowHeight = 35
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
}
|
186
|
+
|
187
|
+
var appDelegate:AppDelegate = UIApplication.shared.delegate as! AppDelegate
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
//Table Viewのセルの数を指定
|
192
|
+
|
193
|
+
override func tableView(_ table: UITableView, numberOfRowsInSection section: Int) -> Int {
|
194
|
+
|
195
|
+
|
196
|
+
|
197
|
+
//let singer = appDelegate.singerList
|
198
|
+
|
199
|
+
return self.appDelegate.xAR.count
|
200
|
+
|
201
|
+
}
|
202
|
+
|
203
|
+
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
//各セルの要素を設定する
|
208
|
+
|
209
|
+
override func tableView(_ table: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
//tableCell の ID (aCell)で UITableViewCell のインスタンスを生成
|
214
|
+
|
215
|
+
let cell = table.dequeueReusableCell(withIdentifier: "aCell", for: indexPath)
|
216
|
+
|
217
|
+
|
218
|
+
|
219
|
+
// Tag番号100でUILabel インスタンスの生成
|
220
|
+
|
221
|
+
let aLabel = table.viewWithTag(100) as! UILabel
|
222
|
+
|
223
|
+
aLabel.text = "\(self.appDelegate.singerAR[indexPath.row])"
|
224
|
+
|
225
|
+
|
226
|
+
|
227
|
+
return cell
|
228
|
+
|
229
|
+
}
|
230
|
+
|
231
|
+
override func didReceiveMemoryWarning() {
|
232
|
+
|
233
|
+
super.didReceiveMemoryWarning()
|
234
|
+
|
235
|
+
}
|
236
|
+
|
237
|
+
}
|
238
|
+
|
239
|
+
```
|
240
|
+
|
241
|
+
|
242
|
+
|
243
|
+
|
244
|
+
|
135
245
|
###試したこと
|
136
246
|
|
137
247
|
|
1
code表示切り替え タグ追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -27,6 +27,8 @@
|
|
27
27
|
Swift3
|
28
28
|
|
29
29
|
|
30
|
+
|
31
|
+
```Swift3
|
30
32
|
|
31
33
|
// Cell が選択された場合
|
32
34
|
|
@@ -126,6 +128,8 @@
|
|
126
128
|
|
127
129
|
}
|
128
130
|
|
131
|
+
```
|
132
|
+
|
129
133
|
|
130
134
|
|
131
135
|
###試したこと
|