ios - Error with tableview -
i'm new swift , ios programming trying data load using table view error have never seen before. can please me out. error showing on line trying pass cell text label array created. error "could not find overload subscript accepts supplied arguments" 
import uikit class viewcontroller: uiviewcontroller, uitableviewdelegate { var cellcontent = [1,2,3] override func viewdidload() { super.viewdidload() // additional setup after loading view, typically nib. } func tableview(tableview: uitableview, numberofrowsinsection section: int) -> int { return cellcontent.count } func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { var cell = uitableviewcell(style: uitableviewcellstyle.default, reuseidentifier: "cell") cell.textlabel?.text = cellcontent[indexpath.row] return cell }
looks error little misleading. actual issue here seems trying set int string property. can this:
cell.textlabel?.text = string(cellcontent[indexpath.row]) with change, code works fine me.
Comments
Post a Comment