Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UICollectionView didDeselectItemAt not get triggered

I have a UICollectionView, and when selecting an item didDeselectItemAt not get triggered, but when selecting an other item, the first will get triggered. Why?

This is have method is implemented:

override func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {

    let userSetting = userSettings[(indexPath as NSIndexPath).row]
    selectedUserSettingRecordName = userSetting.id
    containerViewController!.performSegue(withIdentifier: "message", sender:self)

}

There is no view above the collectionView which could interfere.

like image 602
János Avatar asked Feb 06 '23 23:02

János


1 Answers

is not

didDeselectItemAt - is called in second time, if you select the any item after that it will call

override func collectionView(_ collectionView: UICollectionView, didDeselectItemAt indexPath: IndexPath) {

it is

didSelectItemAt - is called in first time, if you select the any item it will call

 override func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath) { 
like image 160
Anbu.Karthik Avatar answered Feb 13 '23 06:02

Anbu.Karthik