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
Post a Comment