ios - Assigning a value out of array of arrays, using section in Xcode -
this code:
let servicebonnen = [[1,2,3],[4,5,6],[7,8,9]] //not real data func tableview(tableview: uitableview, cellforrowatindexpath indexpath: nsindexpath) -> uitableviewcell { let cell = tableview.dequeuereusablecellwithidentifier("namecell", forindexpath: indexpath) cell.textlabel!.text = servicebonnen[section][indexpath.row] return cell }
but gives me error @ "section" point in line of code:
cell.textlabel!.text = servicebonnen[section][indexpath.row]
does know why won't compile, , proper solution?
you need use section
indexpath
:
indexpath.section
your line should this:
cell.textlabel!.text = servicebonnen[indexpath.section][indexpath.row]
Comments
Post a Comment