Friday, 15 August 2014

ios - ViewController does not confirm to protocol UITableViewDataSource -



ios - ViewController does not confirm to protocol UITableViewDataSource -

i done right still showing error "viewcontroller not confirm protocol" searched lot on site find same question did't find right reply add together connection of uitableview uitableviewdelegate , uitableviewdatasource still showing error should do

here code

class viewcontroller: uiviewcontroller,uitableviewdelegate,uitableviewdatasource { override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } @iboutlet var tableview: uitableview! func tableview(tableview:uitableview!, numberofrowsinsection section:int) -> int { homecoming 20 } func tableview(tableview: uitableview!, cellforrowatindexpath indexpath: nsindexpath!) -> uitableviewcell! { allow cell:uitableviewcell=uitableviewcell(style: uitableviewcellstyle.subtitle, reuseidentifier: "mycell") cell.textlabel.text="row#\(indexpath.row)" cell.detailtextlabel.text="subtitle#\(indexpath.row)" homecoming cell } }

note removal of ! in delegate methods wrong here.

class viewcontroller: uiviewcontroller,uitableviewdelegate,uitableviewdatasource { override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. } override func didreceivememorywarning() { super.didreceivememorywarning() // dispose of resources can recreated. } @iboutlet var tableview: uitableview! func tableview(tableview:uitableview, numberofrowsinsection section:int) -> int { homecoming 20 } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { allow cell:uitableviewcell=uitableviewcell(style: uitableviewcellstyle.subtitle, reuseidentifier: "mycell") cell.textlabel.text="row#\(indexpath.row)" cell.detailtextlabel.text="subtitle#\(indexpath.row)" homecoming cell } }

ios uitableview swift

No comments:

Post a Comment