Może to jest to, czego potrzebujesz:
Podklasa UICollectionViewController jak ABCCollectionViewController
:
let vc = UINavigationController(rootViewController: ABCCollectionViewController())
potem w viewDidLoad
z ABCCollectionViewController
:
self.navigationItem.leftBarButtonItem = self.editButtonItem
następnie zastąpić metodę setEditting:
override func setEditing(_ editing: Bool, animated: Bool) {
super.setEditing(editing, animated: true)
// Use these methods to do the edit things, without test but should works
collectionView?.beginInteractiveMovementForItem(at: indexPath)
print("editting")//Do some edit thing
collectionView?.endInteractiveMovement()
collectionView.updateInteractiveMovementTargetPosition()
collectionView?.cancelInteractiveMovement()
}
Następnie można wywołać:
setEditing(true, animated: true)