Ján*_*nos 4 ios uicollectionview swift swift3
我有一个UICollectionView,当选择一个项目didDeselectItemAt没有被触发时,但是当选择其他项目时,第一个项目将被触发.为什么?
这是有方法实现:
override func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {
let userSetting = userSettings[(indexPath as NSIndexPath).row]
selectedUserSettingRecordName = userSetting.id
containerViewController!.performSegue(withIdentifier: "message", sender:self)
}
Run Code Online (Sandbox Code Playgroud)
上面没有collectionView可能干扰的视图.
不是
didDeselectItemAt - 在第二次调用,如果您选择之后将调用的任何项目
override func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {
Run Code Online (Sandbox Code Playgroud)
它是
didSelectItemAt - 在第一次调用时,如果您选择它将调用的任何项目
override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) {
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1357 次 |
| 最近记录: |