gpt4 book ai didi

ios - 错误 :'inout IndexPath' 不可转换为 'IndexPath'

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:55:00 26 4
gpt4 key购买 nike

我有一个 TableViewController,其中包含使用 CoreData 的数据条目列表。我还有带 TextView 的 ViewController。我已经完成了对项目的添加、保存和删除等操作。现在我正在通过将选定的 TableViewCell 链接到下一个 ViewController 上的 TextView 来进行编辑。但是,我收到错误消息,因为“inout IndexPath”无法转换为“IndexPath”。如何解决这个错误?

最佳答案

func getIndexPathForSelectedCell() -> IndexPath?
{
var indexPath2:IndexPath?

if TABLEVIEW.indexPathsForSelectedItems!.count > 0 {
indexPath2 = TABLEVIEW.indexPathsForSelectedItems![0]
}
return indexPath2
}

override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if (segue.identifier == "detailView")
{
print("Segue Clicked. werwerewrere..................................")
if let indexPath2 = getIndexPathForSelectedCell()
{
// here write code for move to next controller.
let YOUR_NEXT_CONTROLLER_OBJECT = segue.destination as! YOUR_NEXT_CONTROLLER_CLASS_NAME
YOUR_NEXT_CONTROLLER_OBJECT.KEY = PASS_DATA_VALUE
}
}

}

关于ios - 错误 :'inout IndexPath' 不可转换为 'IndexPath',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41339462/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com