-3
辞書の配列でtableViewを作成しました。どうすれば、セルの内容をコアデータに保存し、別のテーブルで取得できますか?テーブルビューから別のTableVIewへの3速データのスウィフト?
私はのtableViewへの辞書の配列をロード:
func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {
let cell = tableView.dequeueReusableCell(withIdentifier: "Cell", for: indexPath) as! SourceTableViewCell
cell.titleLabel.text = sourceFeeds[indexPath.row]["title"]
cell.linkLabel.text = sourceFeeds[indexPath.row]["link"]
return cell
}
今、私はコアデータにそれらのリンクとタイトルを保存したいセルを選択して
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
self.tableView.deselectRow(at: indexPath, animated: true)
let cell = self.tableView.cellForRow(at: indexPath) as! SourceTableViewCell
if self.tableView.cellForRow(at: indexPath)?.accessoryType == UITableViewCellAccessoryType.none {
self.tableView.cellForRow(at: indexPath)?.accessoryType = UITableViewCellAccessoryType.checkmark
} else {
self.tableView.cellForRow(at: indexPath)?.accessoryType = UITableViewCellAccessoryType.none
}
}
を私はsourceFeeds」というを言及したいと思います"配列はplistからロードされました!
これは非常に広いです。あなたはこれまでに試したことを示すことができますか? – brimstone
'tableView.cellForRow(at')を3回呼び出すのは非常に非常に非効率です。 – vadian