gpt4 book ai didi

ios - Mac Catalyst 滑动删除功能在 Mac 上不起作用

转载 作者:行者123 更新时间:2023-11-29 05:08:43 28 4
gpt4 key购买 nike

滑动删除在 maccatalyst 中不起作用。相同的代码在 iPad 上运行良好。

maccatalyst 中未调用 UITableview trailingSwipeActionsConfigurationForRowAt 方法。

func tableView(_ tableView: UITableView, canEditRowAt indexPath: IndexPath) -> Bool
{

if indexPath.row == RestrictedDeletionRoom
{
return false
}
else
{
return true
}
}

func tableView(_ tableView: UITableView, commit editingStyle: UITableViewCellEditingStyle, forRowAt indexPath: IndexPath) {

if editingStyle == .delete {

tableView.deleteRows(at: [indexPath], with: .fade)
}
}

func tableView(_ tableView: UITableView, trailingSwipeActionsConfigurationForRowAt indexPath: IndexPath) -> UISwipeActionsConfiguration? {

let delete = UIContextualAction(style: .destructive, title: "Delete") { (action, sourceView, completionHandler) in

self.deletedRowDict = self.RoomsListArray.object(at: indexPath.row) as! NSDictionary

if let cell = tableView.cellForRow(at: indexPath) as? RoomsListCellTableViewCell {
let storyboard: UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let popoverContent = storyboard.instantiateViewController(withIdentifier: "tableViewCellPopUp") as! tableViewCellPopUp
popoverContent.delegate = self
popoverContent.modalPresentationStyle = .popover
popoverContent.view.superview?.layer.cornerRadius = 1
popoverContent.msgTxt?.text = "Are you sure you want to delete this Room?"

if let popover = popoverContent.popoverPresentationController {

let viewForSource = cell.deleteView
popover.sourceView = viewForSource
popover.permittedArrowDirections = .left
// the position of the popover where it's showed
popover.sourceRect = (viewForSource?.bounds)!

popoverContent.preferredContentSize = CGSize(width:400,height:65)//
}
self.present(popoverContent, animated: true, completion: nil)
}
completionHandler(false)
}

let swipeAction = UISwipeActionsConfiguration(actions: [delete])
swipeAction.performsFirstActionWithFullSwipe = false
return swipeAction
}

有人解决这个问题了吗?

最佳答案

您是否尝试使用鼠标向下滑动或通过 Apple 鼠标滚动手势(鼠标上的水平滑动手势)进行滚动滑动?滑动通常需要鼠标滑动手势,而不是 Mac Catalyst 上的鼠标按下

关于ios - Mac Catalyst 滑动删除功能在 Mac 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/59895546/

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