質問するログイン新規登録

質問編集履歴

2

諸々

2018/10/04 05:12

投稿

nekokichi
nekokichi

スコア54

title CHANGED
File without changes
body CHANGED
@@ -109,4 +109,22 @@
109
109
  ```
110
110
 
111
111
  TableViewCell.xib
112
- ![イメージ説明](80917259ca0be61a8b8effa72dffba5c.png)
112
+ ![イメージ説明](80917259ca0be61a8b8effa72dffba5c.png)
113
+
114
+
115
+ ※追記
116
+ ご回答通りに記述してもだめだったので、
117
+ ```Swift
118
+ func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
119
+
120
+ //gurad文でカスタムセルを読み込み、無理ならUITableViewCell()を返す
121
+ guard let cell = tableView.dequeueReusableCell(withIdentifier: "cell", for: indexPath) as? TableViewCell else { return UITableViewCell() }
122
+
123
+ // cell.backgroundColor = dataSource[indexPath.row]
124
+ cell.contentView.backgroundColor = dataSource[indexPath.row]
125
+
126
+ return cell
127
+
128
+ }
129
+ ```
130
+ と書きましたが、だめでした。

1

諸々

2018/10/04 05:12

投稿

nekokichi
nekokichi

スコア54

title CHANGED
File without changes
body CHANGED
@@ -11,8 +11,16 @@
11
11
 
12
12
  delegata,datasourceに必要なtableViewのメソッドは全て記述してるか確認しましたが、どこも異常はありませんでした。
13
13
 
14
- どこがダメなか指摘していただきたいです。
14
+ 下記記事のサンプルコードと同じに書いたですが、ダメでした
15
+
16
+ [Qiita そのまま使える!iOSアプリを作るためのswiftサンプル集](https://qiita.com/ryupaka/items/54192d304253103c07e9#認証機能localauthenticationsample)
15
17
 
18
+ 同じコードなのに動作しないのは、Swift4から仕様が変わったからでしょうか?
19
+
20
+ Qiitaの記事は最終更新日が比較的新しいので、コード的にも今の環境に適していると思うのですが、そうでなければ僕のコードが間違っているなのでしょうが、どこが間違いかわかりません。
21
+
22
+ どうかダメなのか指摘していただきたいです。
23
+
16
24
  よろしくお願いします。
17
25
 
18
26
  ```Swift