質問編集履歴

2

修正

2016/09/14 05:21

投稿

mk_
mk_

スコア18

test CHANGED
File without changes
test CHANGED
@@ -13,6 +13,10 @@
13
13
  追記
14
14
 
15
15
  タグをつけて、処理をわけてみたのですが、引っかかってしまうようです・・・
16
+
17
+ 4行目(let cell2 = ... )のところがbreakpoint1.1と表示されます。
18
+
19
+ セルのidentifierは、左テーブルのものにはCell1、右にはCell2と設定してあります。
16
20
 
17
21
 
18
22
 

1

更新

2016/09/14 05:21

投稿

mk_
mk_

スコア18

test CHANGED
File without changes
test CHANGED
@@ -7,3 +7,47 @@
7
7
  一つのテーブルビューは簡単に設定ができたのですが、もうひとつのテーブルビューはどうやって設定すればいいかわからず、調べたところタグ付けすればいいということが分かったのですが、うまくいかず・・・
8
8
 
9
9
  初歩的な問題かと思いますが、回答よろしくお願いします。
10
+
11
+
12
+
13
+ 追記
14
+
15
+ タグをつけて、処理をわけてみたのですが、引っかかってしまうようです・・・
16
+
17
+
18
+
19
+ ```swift
20
+
21
+ func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell {
22
+
23
+ //各行に表示するセルを返す(必須)
24
+
25
+ let cell1 = tableView.dequeueReusableCellWithIdentifier("Cell1", forIndexPath: indexPath) as UITableViewCell
26
+
27
+ let cell2 = tableView.dequeueReusableCellWithIdentifier("Cell2", forIndexPath: indexPath) as UITableViewCell
28
+
29
+ //セル番号を表示する
30
+
31
+ if tableView.tag == 1 {
32
+
33
+ cell1.textLabel?.text = "セル" + (indexPath.row).description
34
+
35
+ cell1.detailTextLabel?.text = "サブタイトル"
36
+
37
+ return cell1
38
+
39
+ } else {
40
+
41
+ cell2.textLabel?.text = "セル" + (indexPath.row).description
42
+
43
+ cell2.detailTextLabel?.text = "サブ"
44
+
45
+ return cell2
46
+
47
+ }
48
+
49
+ }
50
+
51
+
52
+
53
+ ```