Ufuk Can Bicici
Ufuk Can Bicici

Reputation: 3649

IPhone development: How to build a custom view hierarchy?

I am pretty new to iOS and iOS development and I need to accomplish a rather complicated task for me. The app I am working on has a main view, from where the user must be able to move to three different views by clicking three different buttons. These views will have their own sub-view hierarchies but this is not my goal for now. For now, I am working to accomplish this subtask. I have read most of the basic tutorials about iPhone development and learned that the class UINavigationController is responsible for traversing in the view hierarchy. As far as I can see from the tutorials, UINavigationController provides a navigation bar but this provides a transition just to a single view. My first question is how can I build a custom navigation system, should I subclass and somehow modify UINavigationController or is an another method possible? This may be a very simple question but there are tons of materials out there which only confuses me further.

Upvotes: 0

Views: 346

Answers (5)

Ufuk Can Bicici
Ufuk Can Bicici

Reputation: 3649

Thanks to everyone who shared their knowledge. I think I have figured out how to create a simple view hierarchy and I am applying that for the moment. I use a UINavigationController and call its push-pop methods on the view controllers I have created from .xib files. By the way the tutorial at http://www.simplecode.me/2011/09/04/an-introduction-to-uinavigationcontroller/ was very helpful as well, in case for other newbies like me seeking ways to build view hierarchies.

Upvotes: 0

JRG-Developer
JRG-Developer

Reputation: 12663

First off, don't subclass UINavigationController. Apple says not to, and there really isn't a good reason to do such.

It sounds like you need to work through some more tutorials before attempting to create this app. I'd highly recommend Ray Wenderlich's site that has lots of free tutorials and also the 'iOS by Example' series that he offers. (See http://www.raywenderlich.com/)

Just go through some of his free tutorials to start, almost all of them show how to do what you're looking for.

Good luck!

Edit

"Vertical tabs" aren't a native component in iOS. However, it appears that there are some 3rd party repos that might do the trick. I haven't used this personally, but it seems to be recommned on other SO posts (see iOS vertical tab bar), see if this helps:

https://github.com/futuresimple/FSVerticalTabBarController

Upvotes: 3

M. Bedi
M. Bedi

Reputation: 1086

Depending on your needs, you can create your own navigation hierarchy using containment; this was introduced in iOS 5. There is more work involved if you go this way.

I recently used it for doing some custom user interfaces. In one case, I needed to use containment with a UI Page View Controller.

If anything, draw a diagram to represent the controller view hierarchy that you need to build first & then decide if you need to go down this route.

Here is the link to Apple's documentation.

Apple documentation on creating custom container view controllers

There is also a video from WWDC 2011.

Upvotes: 0

foundry
foundry

Reputation: 31745

Take a look at UITabBarController.

A tab bar manages an array of viewControllers. It may be much closer to what you have in mind than UINavigationController and more straightforward to implement. Each tab bar item can be a NavController with its own hierachy, or a single viewController.

Upvotes: 0

Scott Roepnack
Scott Roepnack

Reputation: 2735

I would not subclass UINavigationController

Since you are new to iOS development, I suggest you use storyboarding to complete your flow. This could be achieved fairly easily, with the UINavigationController, UIButtons, and other basic elements.

You will have to build an application that is iOS 5 and above to use storyboarding.

Upvotes: 0

Related Questions