ios - Tableview to Tableview -


i complete novice coding , app building apologies beforehand if has easy solution. have created app has tab bar @ bottom , tableview on 1 of tabs. have populated cells in tableview.

i looking able select cell , go tableview different categories based on cell selection. e.g. first table view: dogs, snakes, rabbits. second table view: labrador, shitzu, poodle (if 'dogs' cell selected) python, cobra, rattlesnake (if 'snakes' cell selected). etc.

you'll want embed these 2 tableviewcontrollers in navigation controller.

you can in storyboard:

  1. select tableviewcontroller first table in it

  2. in xcode's menu bar: editor > embed in > navigation controller

  3. create tableviewcontroller in storyboard.

  4. ctrl+drag storyboard segue tableviewcell on first tableviewcontroller second tableviewcontroller. @hw731 said, indicate when cell tapped invoke segue new tableviewcontroller.

--now move code.

  1. in .m file first view controller can pass whatever data want pass second vc. (like, fact chose dog)

  2. in -(void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender method:

    • grab reference second view controller so: secondtableviewcontroller *secondtablevc = segue.destinationviewcontroller
    • now can secondtablevc.arrayofitemstodisplay = dogsarray;

there interim steps in there creating class second tableviewcontroller , connecting it. hope helps!


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -