Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 11-30-2008, 05:54 PM   #1 (permalink)
New Member
 
Join Date: Nov 2008
Posts: 2
Default Having multiple view controllers in one application

Hi there

I'm a relatively new iPhone developer (although I'm gradually learning how things work..) but I've got a problem and can't find an easy solution. I was hoping someone could point me in the right direction. I'm finding view controllers to be the hardest thing to wrap my head around, so this problem is related to these.

I'm trying to build an application that will have a number of different 'types' of screen. The general user workflow will be as follows:

1. Login (using some sort of view controller I haven't yet determined)
2. Select some basic settings (using a NavigationViewController that I have already created)
3. Use a main menu (which is a TabBarViewController that I have already created)
4. From this main menu, select one of the tabs. Some of these will have buttons on them that then need to take them to another NavigationViewController, but WITHOUT the tabs being displayed.


I've managed to get most of the pieces of this working independently. Now I'm trying to hook it all up together. However, I'm really stuck about exactly where I should put the code to load each of the new controllers, and also what this code should look like.

I assume it will look like the following, from the app delegate:

Code:
// navigation controller for settings selection (step 2 above)
navigationController = [[UINavigationController alloc] init];

UIViewController *firstViewController = [[MyFirstNavigationViewController alloc] initWithNibName:@"FirstScreenForNumber2Above"                                 bundle:[NSBundle mainBundle]];
[navigationController pushViewController:firstViewController 
                                    animated:NO];
[firstViewController release];
[window addSubview:navigationController.view];
    
[window makeKeyAndVisible];
But again, I'm not sure exactly what I should be doing and where.

Can anyone help by either giving me an idea of this, or pointing me in the direction of a sample that uses this type of structure?

Many thanks in advance,

John

Last edited by JohnD; 11-30-2008 at 06:02 PM.
JohnD is offline   Reply With Quote
Old 11-30-2008, 08:03 PM   #2 (permalink)
New Member
 
Join Date: Nov 2008
Posts: 123
Default

It sounds as if you need to simplify-- to better implement your app and, so as not to confuse the user with too many competing UIs.

The Tab Bar is meant to be the UI that allows you switch among many ways of navigating and still remain consistent and intuitive.

In other words, if you need a tab bar, it should always be present. The exception would be, say, invoking the movie player to play a video at full screen. In this case, the tab bar reappears when the video completes.

So, you might have a tab for login with a single view; another with a nav bar Table View to drill-down into a web view; a third that allows you too flip through photos; a fourth that plays a movie...

the common denominator is the tab bar-- you are switching contexts, and the tab bar should always be there to guide the user.

There is a very good (and long) thread about nav bar/tab bar on this forum at:

http://www.iphonedevsdk.com/forum/ip...tableview.html

HTH

Dick

Last edited by dicklacara; 11-30-2008 at 08:54 PM.
dicklacara is offline   Reply With Quote
Old 12-02-2008, 05:11 PM   #3 (permalink)
New Member
 
Join Date: Nov 2008
Posts: 2
Default

Hi Dick,

Thanks very much for your prompt reply.

I've given the UI design a lot of thought and unfortunately can't come up with anything better in terms of a user workflow. The application requires that the user complete a couple of specific tasks before they get to the main (tab-based) screen, and there's really no way around this. Normally I would agree that this is overcomplicated, but for what I'm doing it's hard to work around.

Given that, I've been further experimenting with swapping out view controllers, and have managed to get it working by calling the view controllers' view.removeFromSuperview method and adding the new controller to the window. This works, although I'm not 100% sure it's the right way to do it. Also, there's no animation - the views just disappear and appear.

If there's any guidance on the 'correct' way to swap between view controllers, it would be great to get an idea of this. Otherwise I'll just continue with the way I'm doing this.

Thanks again for your help.

John
JohnD is offline   Reply With Quote
Reply

Bookmarks

Tags
view controllers

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 241
13 members and 228 guests
ADY, AragornSG, CKAmike, Dani77, Duncan C, HDshot, HemiMG, Promo Dispenser, Punkjumper, Rudy, sacha1996, sneaky, spiderguy84
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,231
Posts: 380,768
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 03:20 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0