ios - Swift segue from CollectionViewCell failing to display new view -
i'm trying load new view when cell in collectionview
selected.
everywhere online says it's simple registering new view , navigation controller in storyboard, , ctrl + click dragging collectionviewcell
new view.
having done this, code compiles , runs, no new view appears when click on cells. have missed?
the storyboard says there segue collectionview
next view (identified correct name , all), i'm bit confused...
edit: here collectionview
controller code, in case i've done in here that's causing problem. it's calendar page (as can tell code):
iboutlet weak var calendarcollection: uicollectionview! var collectionview: uicollectionview? let calendarcellidentifier: string = "calendarcell" override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. let layout: uicollectionviewflowlayout = uicollectionviewflowlayout() layout.sectioninset = uiedgeinsets(top: 50, left: 10, bottom: 10, right: 10) layout.itemsize = cgsize(width: 60, height: 60) collectionview = uicollectionview(frame: self.view.frame, collectionviewlayout: layout) collectionview!.datasource = self collectionview!.delegate = self collectionview!.registerclass(uicollectionviewcell.self, forcellwithreuseidentifier: calendarcellidentifier) collectionview!.backgroundcolor = uicolor.blackcolor() self.view.addsubview(collectionview!) } // return collectionview cell @ indexpath func collectionview(collectionview: uicollectionview, cellforitematindexpath indexpath: nsindexpath) -> uicollectionviewcell { let cell: uicollectionviewcell = collectionview.dequeuereusablecellwithreuseidentifier(calendarcellidentifier, forindexpath: indexpath) uicollectionviewcell cell.backgroundcolor = uicolor.bluecolor() return cell } func collectionview(collectionview: uicollectionview, shouldhighlightitematindexpath indexpath: nsindexpath) -> bool { return true } func collectionview(collectionview: uicollectionview, numberofitemsinsection section: int) -> int { return challengedurationdays }
for similar problems, solved manually triggering segue using didselectitematindexpath
method. don't think should have had this, perhaps misunderstood. either or it's bug. method added collectionviewcontroller
in end looks this:
func collectionview(collectionview: uicollectionview, didselectitematindexpath indexpath: nsindexpath) { performseguewithidentifier("dayviewsegue", sender: calendarcollection) }
Comments
Post a Comment