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

Popular posts from this blog

networking - Vagrant-provisioned VirtualBox VM is not reachable from Ubuntu host -

c# - ASP.NET Core - There is already an object named 'AspNetRoles' in the database -

ruby on rails - ArgumentError: Missing host to link to! Please provide the :host parameter, set default_url_options[:host], or set :only_path to true -