2017-03-15 106 views
-3

我使用字典数组填充tableView现在,我如何将单元格内容保存到核心数据并在另一个tableView中检索它?swift 3从tableView传递数据到另一个TableVIew?

我装字典到的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加载!

+1

这是非常广泛的。你能证明你到目前为止所尝试过的吗? – brimstone

+0

调用'tableView.cellForRow(at')三次是非常非常低效的。 – vadian

回答

0

我终于找到了我的问题的解决方案!

相关问题