ios - iPad Navigation between different subviews -
i'm experienced programmer, new ios/objc. need add feature existing ipad app, , i'm not sure how go it.
the app has view (let's call infoview) several subcomponents, 1 of tableview (tableview), , 2 of buttons (buttona , buttonb) (plus other stuff that's irrelevant problem).
when buttonb pressed, tableview needs replaced other view (let's call detailviewa) various items on. (buttona takes tableview - these buttons act pseudo tab buttons) when 1 of items in detailviewa selected, detailviewa needs replaced detailviewb. when detailviewb closed, detailviewa should re-appear.
i believe can toggling between tableview , detailviewa hiding appropriate 1 when buttona/buttonb pressed, don't know how nicely deal drilling down detailviewb , again (preferably sliding animation) - thought perhaps maybe uinavigationcontroller, after research still can't see how i'd embed uinavigationcontroller inside subview.
a picture tells thousand words, here's rough sketch of i'm talking about:
+--------------------------------------------------------------------------+ | infoview | topview | | [buttona] [buttonb] | | | (show table) (show detail) | | | ---------------------------------- | | | | | | area contains tableview | | | | | | when buttonb touched | other stuff here | | needs display detailviewa | | | ability drill down | | | deeper detailviewb (and | | | maybe deeper) | |
or hierarchically: ( [ ] indicating uncertainty / unimplemented)
topview \ infoview \ buttona | buttonb | tableview - shown when buttona pressed | [ moreinfoview? ] - shown when buttonb pressed \ [ detailviewa ] | [ detailviewb ]
what's best way implement functionality?
you can embed navigation controller inside view using child view controllers. set navigation controller controller detailviewa root view controller, call code embed navigation controller:
[self addchildviewcontroller:self.detailnavigationcontroller]; self.detailnavigationcontroller.view.frame = frameoftableview; [self.view addsubview:self.detailnavigationcontroller.view]; [self.detailnavigationcontroller didmovetoparentviewcontroller:self];
you hide original table view when button pressed , show navigation controller. navigation controller handle "drilling down" between detail views.
note need view controllers detailviewa , detailviewb, not views.
hope helps!
Comments
Post a Comment