Still feeling pretty green in Objective-C – building my first “real” project and hit an architectural snag early on..
I’d like to present my views and navigation in a fully ‘custom’ environment – e.g. something where I hide all of the built-in UI controls (e.g. UINavigationController or UITabBar). One specific example (as in the title): moving from a ‘main’ view directly to a UIImagePickerController, and then right from the UIImagePickerController to a new third view.
Here are the three primary view controllers I’m working with:
- MainViewController (custom subclass of UIViewController, contains my main Nav and is in general my primary or ‘parent’ controller)
- ImageEditViewController (custom subclass of UIViewController wherein I overlay some controls on top of a stored image)
- UIImagePickerController (built-in Apple class)
There are a couple of approaches I can image for this (but I can’t figure out how to do either one):
- Use a UINavigationController or UITabBar implementation, but somehow hide the system UI controls and implement my own. I am blocked on this approach because – simply – I don’t know how to hide the system UI controls.
- Call controller-to-controller or view-to-view transitions manually at specific points in the code. I sort of prefer this method but I can’t figure out the best ‘approach’ to instantiating and managing and transitioning between my controllers. Example of things I don’t know: how do I call a second view controller from my main view controller? How do I call a third view controller directly from the second? (Or at least transition to the third directly!)
I assume there is an easy solution here; just something I haven’t learned yet about managing views and view controllers outside of Apple’s helper classes.
What system UI controls are you talking about? The navigation bar?
You can just do
myNavigationController.navigationBarHidden = YES; for aUINavigationCOntroller.Documentation here.
As for the kind of navigation you should have, that really depends on your use case. Are you trying to achieve a hierarchy or workflow? Then perhaps a navigation controller is what you want. Is each view controller a separate piece that does not necessarily follow a workflow? Then a tab bar controller could work.
For tab bar you should be able to do something like: