ios - Koloda delegate : fatal error: unexpectedly found nil while unwrapping an Optional value -
i using koloda in project , whenever try load 1 view controller in particular error "fatal error: unexpectedly found nil while unwrapping optional value" on kolodaview.datasource = self
, if commented out same error on kolodaview.delegate = self
. new ios , swift not sure going on. following code in koloda viewcontroller
showing error:
override func viewdidload() { super.viewdidload() kolodaview.datasource = self kolodaview.delegate = self self.modaltransitionstyle = uimodaltransitionstyle.fliphorizontal }
the following code uiviewcontroller
trying load. not linked via segues.
import foundation import uikit class genderselection1: viewcontroller, uitableviewdelegate, uitableviewdatasource{ @iboutlet weak var tableview: uitableview! override func viewdidload() { super.viewdidload() self.tableview.delegate = self self.tableview.datasource = self } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } // mark: - table view data source func numberofsectionsintableview(tableview: uitableview) -> int { return 2 } func tableview(tableview: uitableview, viewforheaderinsection section: int) -> uiview? { let headercell = tableview.dequeuereusablecellwithidentifier("headercell") as! uitableviewcell headercell.backgroundcolor = uicolor.grouptableviewbackgroundcolor() return headercell } func tableview(tableview: uitableview, heightforheaderinsection section: int) -> cgfloat { return 1 } func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return 1 } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("cell", forindexpath: indexpath) as! uitableviewcell return cell } func tableview(tableview: uitableview, didselectrowatindexpath indexpath: nsindexpath) { tableview.deselectrowatindexpath(indexpath, animated: true) } }
kolodaview instance nil. verify putting nslog right after super.viewdidload().
nslog("kolodaview \(kolodaview)");
i think, have not connected iboutlet properly. need check out.
Comments
Post a Comment