swift 2.2
xcode 7.3
realm 0.98
swiftについて教えていただきたいのですが、
下記の関数でデータを返して、その値をセルに表示させたいのですが、
セルに表示させる方法がわかりません。
現在の記述は、以下になります。
swift
1func Title() -> String{ 2 return String(realm.objects(POST).map{$0.title}) 3 }
セルの記述
swift
1func tableView(tableView: UITableView, cellForRowAtIndexPath indexPath: NSIndexPath) -> UITableViewCell{ 2 let cell = UITableViewCell(style: UITableViewCellStyle.Subtitle, reuseIdentifier: "questionCell") 3 if indexPath.section == 0 { 4 cell.textLabel?.text = Title() //ここの部分に表示させたいと思ってます。 5 cell.detailTextLabel?.text = Detail[indexPath.row] 6 cell.imageView?.image = UIImage(named: "\(numderImageArray[indexPath.row]).png") 7 } else { 8 cell.textLabel?.text = TESTTitle[indexPath.row] 9 cell.detailTextLabel?.text = TESTDetail[indexPath.row] 10 cell.imageView?.image = UIImage(named: "\(numderImageArray[indexPath.row]).png") 11 } 12 return cell 13 }
現状。
cell.textLabel?.text = Title() //ここの部分に表示させたいと思ってます。
↑↑↑↑↑↑↑上記のセルのタイトル欄に配列すべては表示はできましたが、
その配列のなかを1つ1つ分けて表示させる記述がわかりません。
宜しくお願いいたします。
回答1件
あなたの回答
tips
プレビュー