回答編集履歴

1

追記

2019/09/04 04:18

投稿

unhappychoice
unhappychoice

スコア1531

test CHANGED
@@ -16,7 +16,19 @@
16
16
 
17
17
  // indexPath.section, indexPath.row から twoDimArray の対応する物を探す
18
18
 
19
+ let name = twoDimArray[indexPath.section][indexPath.row]
20
+
21
+ var price: Int
22
+
19
- // 対応から値段取得 例えば let price = Book[name]
23
+ if indexPath.section == 0 { // 対応から値段取得 Book の section だった場合
24
+
25
+ price = Book[name]
26
+
27
+ } else if indexPath.section == 1 {
28
+
29
+ //...
30
+
31
+ }
20
32
 
21
33
  // 合計値を出したければ、セクションごとの合計用の変数を用意しておいて足していく
22
34