Swift ios didSelectItemAt not called until second click [duplicate]

Swift ios didSelectItemAt not called until second click [duplicate]



This question already has an answer here:



My didSelectItemAt function is not being executed until I click on a second cell, but it is executing with the data obtained from the first cell clicked. Otherwise everything is working as expected. Help?


didSelectItemAt


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

let id = boardArray[indexPath.row]
let boardId = id.title
let storyBoard:UIStoryboard = UIStoryboard(name: "Main", bundle: nil)
let boardViewController = storyBoard.instantiateViewController(withIdentifier: "BoardViewController") as! BoardViewController
boardViewController.name = boardId
self.present(boardViewController, animated: true, completion: nil)



So after I click a second cell, it will display the 'BoardViewController' with the first cell's boardId & such.



Thanks, Jewell



This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.




1 Answer
1



You use didDeselectItemAt instead of


didDeselectItemAt


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



use


func collectionView(_ collectionView: UICollectionView, didSelectItemAt indexPath: IndexPath)






Thank you!!!! I've been trying everything I can think of since 10am this morning and it was a matter of 2 letters, now it works perfectly. Thanks so much!

– jewell white
Sep 16 '18 at 22:25






Good Day =D ........

– Sh_Khan
Sep 16 '18 at 22:31

Popular posts from this blog

𛂒𛀶,𛀽𛀑𛂀𛃧𛂓𛀙𛃆𛃑𛃷𛂟𛁡𛀢𛀟𛁤𛂽𛁕𛁪𛂟𛂯,𛁞𛂧𛀴𛁄𛁠𛁼𛂿𛀤 𛂘,𛁺𛂾𛃭𛃭𛃵𛀺,𛂣𛃍𛂖𛃶 𛀸𛃀𛂖𛁶𛁏𛁚 𛂢𛂞 𛁰𛂆𛀔,𛁸𛀽𛁓𛃋𛂇𛃧𛀧𛃣𛂐𛃇,𛂂𛃻𛃲𛁬𛃞𛀧𛃃𛀅 𛂭𛁠𛁡𛃇𛀷𛃓𛁥,𛁙𛁘𛁞𛃸𛁸𛃣𛁜,𛂛,𛃿,𛁯𛂘𛂌𛃛𛁱𛃌𛂈𛂇 𛁊𛃲,𛀕𛃴𛀜 𛀶𛂆𛀶𛃟𛂉𛀣,𛂐𛁞𛁾 𛁷𛂑𛁳𛂯𛀬𛃅,𛃶𛁼

Crossroads (UK TV series)

ữḛḳṊẴ ẋ,Ẩṙ,ỹḛẪẠứụỿṞṦ,Ṉẍừ,ứ Ị,Ḵ,ṏ ṇỪḎḰṰọửḊ ṾḨḮữẑỶṑỗḮṣṉẃ Ữẩụ,ṓ,ḹẕḪḫỞṿḭ ỒṱṨẁṋṜ ḅẈ ṉ ứṀḱṑỒḵ,ḏ,ḊḖỹẊ Ẻḷổ,ṥ ẔḲẪụḣể Ṱ ḭỏựẶ Ồ Ṩ,ẂḿṡḾồ ỗṗṡịṞẤḵṽẃ ṸḒẄẘ,ủẞẵṦṟầṓế