ios - Swift sidebar menu creation -
i trying follow guide found here create swift sidebar menu: https://www.youtube.com/watch?v=qalizguk2t0 have reached following function:
override func tableview(tableview: uitableview!, cellforrowatindexpath indexpath: nsindexpath!) -> uitableviewcell! {     var cell:uitableviewcell? = tableview.dequeuereusablecellwithidentifier("cell") as? uitableviewcell      if cell == nil{         cell = uitableviewcell(style :uitableviewcellstyle.default, reuseidentifier: "cell")         // configure cell...         cell!.backgroundcolor = uicolor.clearcolor()         cell!.textlabel.textcolor = uicolor.darktextcolor()          let selectedview:uiview = uiview(frame: cgrect (x: 0, y:0, width: cell!.frame.size.width, height: cell!.frame.size.height))         selectedview.backgroundcolor = uicolor.blackcolor().colorwithalphacomponent(0.3)          cell!.selectedbackgroundview = selectedview      }      cell!.textlabel.text = tabledata[indexpath.row]      return cell }    i have gotten "overriding method selector 'tableview:cellforrowatindexpath..." error; being new swift not sure @ point. please let me know do, if happen know of better guide please let me know.
for may have issue in future here complete solution of worked me, zisoft this:
    override func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {     var cell:uitableviewcell? = tableview.dequeuereusablecellwithidentifier("cell") as? uitableviewcell      if cell == nil{         cell = uitableviewcell(style :uitableviewcellstyle.default, reuseidentifier: "cell")         // configure cell...         cell!.backgroundcolor = uicolor.clearcolor()         cell!.textlabel.textcolor = uicolor.darktextcolor()          let selectedview:uiview = uiview(frame: cgrect (x: 0, y:0, width: cell!.frame.size.width, height: cell!.frame.size.height))         selectedview.backgroundcolor = uicolor.blackcolor().colorwithalphacomponent(0.3)          cell!.selectedbackgroundview = selectedview      }      cell!.textlabel.text = tabledata[indexpath.row]      return cell! }      
the function signature has changed during evolving of swift. correct signature is:
func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell {     ... }   so remove exclamation marks.
Comments
Post a Comment