ios - How do I connect a TableViewController to my main ViewController? -
right have:
- tableviewcontroller - displays table populated images , has
uitableviewdelegatemethods - viewcontroller- empty except default
viewdidload()fn
when run program, screen blank, presumably because viewcontroller has nothing in it.
how make displays tableviewcontroller?
i have hunch should use prepareforsegue, confused because when prepareforsegue ever called? i've read called before viewdidload(). in case, should add prepareforsegue function in viewcontroller directs tableviewcontroller?
click viewcontroller in storyboard, delete it, , select table view controller in storyboard (click little yellow icon on left 3 icons appear right above controller there blue outline around controller). in attributes inspector in utilities panel on right in xcode, check "is initial view controller". sounds don't need other view controller @ all.
if want segue table view controller view controller, add button or other ui control view controller, control-drag control table view controller, , select segue type. prepareforsegue() called right before segueing; it's way second view controller (in case table view controller) data may need first view controller.
Comments
Post a Comment