ios - How can I add a table view controller to an existing storyboard view controller? -
i'm creating landscape ipad app ios 5.1 should have two table views embedded view controller of storyboard. like able do, drag table view controller onto view controller in storyboard. of course, xcode not allow this. can drag table view , data hooked , works properly, cannot push new view controller replace table when row selected.
i cannot use 'editor > embed in > navigation controller' trick, because entire storyboard view controller (which contains 2 table views) embedded. not want.
there must way programmatically, can't seem right combo of voodoo , science make work.
i have tried create custom container view hold tableviewcontroller
, table isn't showing up.
any thoughts?
- (void)viewdidload { [super viewdidload]; cgrect frame = cgrectmake(68, 187, 402, 474); _containerview = [[uiview alloc] initwithframe:frame]; _containerview.backgroundcolor = [uicolor redcolor]; [self.view addsubview:_containerview]; categorycontroller = [[uitableviewcontroller alloc] init]; categorytable = [[uitableview alloc] init]; categorytable.delegate = self; categorytable.datasource = self; [categorycontroller.view addsubview:categorytable]; [_containerview addsubview:categorycontroller.view]; }
what need container views
here tutorials can you:
http://www.cocoanetics.com/2012/04/containing-viewcontrollers/
http://weblog.invasivecode.com/post/12383262201/container-view-controllers-part-i-one-of-the
Comments
Post a Comment