gpt4 book ai didi

ios - TableView (_ :editActionsForRowAt:) is not called on iOS 9. 3

转载 作者:行者123 更新时间:2023-11-28 12:07:44 25 4
gpt4 key购买 nike

tableView(_:,editActionsForRowAt:) 方法适用于运行 iOS 10 或更高版本的设备,但不会在运行 iOS 9.3 的设备上调用

我正在使用

func tableView(_ tableView: UITableView, editActionsForRowAt indexPath: IndexPath) -> [UITableViewRowAction]?
{
"Code"
return [ "various actions"]
}

在 iOS 10 或更高版本上运行时,编辑操作在我的所有类中都能正常工作,但在一个类中,它在运行 9.3 的设备上根本不起作用。在代码中使用断点看起来这个函数根本没有执行。

最佳答案

如果您的类中根本没有调用该函数,请确保您已正确设置委托(delegate)。

通常这会在 viewDidLoad 中完成。通过设置 tableView.delegate = self。还要确保您有 tableView.dataSource = self。如果它在您的其他 View Controller 中工作,我想那里有一个示例。

如果您使用的是 Storyboard,您还可以在其中设置委托(delegate)和数据源。我敢肯定这只是一个忘记做的案例!

您还需要确保您的类同时扩展了 UITableViewDelegateUITableDataSource

关于ios - TableView (_ :editActionsForRowAt:) is not called on iOS 9. 3,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49093777/

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