TableViewのセルのsubtitleで日付が全部一緒になってしまいます。解決策を教えていただきたいです。
swift
1func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { 2 let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) 3 4 //日付のフォーマットを指定する 5 let format = DateFormatter() 6 format.dateFormat = DateFormatter.dateFormat(fromTemplate: "yMdkHm", options: 0, locale: Locale(identifier: "ja_JP")) 7 8 //日付をStringに変換する 9 let sDate = format.string(from: date) 10 11 //日付をdateArrayに入れる 12 dateArray2.append(sDate) 13 14 cell.textLabel!.text = resultArray2[indexPath.row] 15 cell.detailTextLabel!.text = dateArray2[indexPath.row] 16 17 return cell 18 }
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2019/01/04 09:29
2019/01/04 10:10
2019/01/04 10:53