質問編集履歴
2
更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
TableViewCellsを使って画面推移ができるコードを記述しています。
|
1
|
+
TableViewCellsを使って画面推移ができるコードを記述しています。ページ推移は可能ですが、画像を加えるためのコードを記述するとエラーが出てしまいます。
|
2
2
|
|
3
3
|
|
4
4
|
|
@@ -40,7 +40,7 @@
|
|
40
40
|
|
41
41
|
identities = ["A","B"]
|
42
42
|
|
43
|
-
imgArray = ["img1","img2"
|
43
|
+
imgArray = ["img1","img2"]
|
44
44
|
|
45
45
|
}
|
46
46
|
|
@@ -60,17 +60,17 @@
|
|
60
60
|
|
61
61
|
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell")
|
62
62
|
|
63
|
-
|
64
|
-
|
65
63
|
cell?.textLabel!.text = names[indexPath.row]
|
66
64
|
|
67
65
|
|
68
66
|
|
67
|
+
//画像を加えるためのコード
|
68
|
+
|
69
|
+
|
70
|
+
|
69
71
|
let img = UIImage(named:"\(imgArray[indexPath.row])")
|
70
72
|
|
71
73
|
|
72
|
-
|
73
|
-
// Tag番号 1 で UIImageView インスタンスの生成
|
74
74
|
|
75
75
|
let imageView = tableView.viewWithTag(1) as! UIImageView
|
76
76
|
|
1
更新
test
CHANGED
File without changes
|
test
CHANGED
@@ -36,17 +36,15 @@
|
|
36
36
|
|
37
37
|
|
38
38
|
|
39
|
-
names = ["
|
39
|
+
names = ["セル1","セル2"]
|
40
40
|
|
41
|
-
identities = ["A","B"
|
41
|
+
identities = ["A","B"]
|
42
42
|
|
43
|
-
imgArray = ["
|
43
|
+
imgArray = ["img1","img2","img3","img4"]
|
44
44
|
|
45
45
|
}
|
46
46
|
|
47
47
|
|
48
|
-
|
49
|
-
//Table Viewのセルの数を指定
|
50
48
|
|
51
49
|
override func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int {
|
52
50
|
|