【发布时间】:2016-10-06 09:54:39
【问题描述】:
我有一个UICollectionView,在选择项目didDeselectItemAt not get triggered时,但选择其他项目时,第一个将被触发。为什么?
这是已经实现的方法:
override func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {
let userSetting = userSettings[(indexPath as NSIndexPath).row]
selectedUserSettingRecordName = userSetting.id
containerViewController!.performSegue(withIdentifier: "message", sender:self)
}
collectionView 上方没有可以干扰的视图。
【问题讨论】:
-
didSelect 与 didDeselect?
-
didSelectRowAtIndexPath returns wrong IndexPath 可能重复这个问题是在
UITableView而不是UICollectionView,但系统/原因是相同的。 -
这是每个人最喜欢的错误之一:将
didDeselectItemAt和didSelectItemAt混在一起。
标签: ios swift uicollectionview swift3