Luc*_*rdi 11 uitableview ios uicollectionview uicollectionviewcell
不太可能UITableViewCell,UICollectionViewCell缺乏setEditing:animated:和editing属性.
这是设计的吗?Apple是否在UICollectionView及其单元格中执行其他最佳实践来处理编辑?
Wil*_* Hu -1
也许这就是您所需要的:
UICollectionViewController 子类如下ABCCollectionViewController:
let vc = UINavigationController(rootViewController: ABCCollectionViewController())
Run Code Online (Sandbox Code Playgroud)
然后viewDidLoad在ABCCollectionViewController:
self.navigationItem.leftBarButtonItem = self.editButtonItem
Run Code Online (Sandbox Code Playgroud)
然后重写 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()
}
Run Code Online (Sandbox Code Playgroud)
然后你可以调用:
setEditing(true, animated: true)
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
724 次 |
| 最近记录: |