ios - UITableView navigation on row selection -


well have designed iphone setting in tableview.there 40 setting.so there 40 cells in 8 sections.so there different view controller row.what want navigate corresponding view controller of row without using if-else,switch condition using indexpath.row or indexpath.section.means don't want manipulate rows , sections.thanks in advance.

you can below.

i assuming using segue push different controllers

now suppose have 1 array containing 40 dictionary said. each dictionary contains name.

so structure below

yourmutablearray

  • [0] dictionary
    • "name" : "value"

in same dictionary can add 1 more key , value key "seguename" , value identifier of segue.

so structure below

yourmutablearray

  • [0] dictionary
    • "name" : "value"
    • "seguename" : "pushtosecondview"

now can write in tableview's didselectrowatindexpath

nsdictionary *selectedrowdata = [yourmutablearray objectatindex:indexpath.row]; [self performseguewithidentifier:[selectedrowdata objectforkey:@"seguename"] withobject:nil]; 

so not have put switch conditions in didselectrowatindexpath.

hope you.


Comments

Popular posts from this blog

node.js - How to mock a third-party api calls in the backend -

node.js - Why do I get "SOCKS connection failed. Connection not allowed by ruleset" for some .onion sites? -

matlab - 0-by-1 sym - What do I need to change in order to get proper symbolic results? -