Maccatalyst для удаления не работает в ios 13 - PullRequest
0 голосов
/ 24 января 2020

Проведите, чтобы удалить не работает в maccatalyst. Тот же код работает нормально с Ipad. UITableview trailingSwipeActionsConfigurationForRowAt метод, не вызванный в maccatalyst.

 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
    }

Кто-нибудь решил эту проблему?

1 Ответ

0 голосов
/ 26 января 2020

Вы пытаетесь использовать прокрутку вниз или прокрутку с помощью жеста прокрутки мыши Apple - жест горизонтальной прокрутки мыши? Для смахивания обычно требуется жест смахивания мышью, а не нажатие мыши на Ma c Catalyst

...