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 02-15-2010, 10:50 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 5
Default Navigation controller with buttons?

Hey all!

I want to create a navigation app that would start with 5 large buttons displayed in a view that would look something like screen 1.

Clicking on one of the buttons would do a slide transition (from right to left) to the second view that would look like screen 2.

...and each button would take you to a third screen and so on.

I've read a lot of tutorials about navigation controllers but everyone of them uses a UITableView as the first screen. I can't seem to figure out how I can achieve this but I'm pretty sure it isn't that hard to do...

Thanx!
Attached Images
File Type: jpg screen 1.jpg (6.6 KB, 4 views)
File Type: jpg screen 2.jpg (8.3 KB, 2 views)
nasty_jpp is offline   Reply With Quote
Old 02-16-2010, 04:39 AM   #2 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 117
Default

Hope this helps .Feel free to ask =)
Attached Files
File Type: zip Untitled.zip (21.4 KB, 76 views)
__________________
Praise be to God
Brix is offline   Reply With Quote
Old 02-16-2010, 07:31 AM   #3 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 5
Default

Quote:
Originally Posted by Brix View Post
Hope this helps .Feel free to ask =)
Thanks Brix!!!

This is exactly what I want to do! I looked at your sample project but I'm still having a hard time knowing how everything's hooked up together. My main problem is how to link everything in the MainWindow.xib. Would you be able to brief me on the steps you went through to make it all work please?

Thanx again that was fast!
nasty_jpp is offline   Reply With Quote
Old 02-17-2010, 02:24 AM   #4 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 117
Default

Here's how I do it. From the start.

1.Create a new project, choose a Window-based Application. For example I named my project as Test.
//You will then have only two files, your TestAppDelegate.h and .m.

2.On your .h, create an "IBOutlet UINavigationController" like this:
Code:
#import <UIKit/UIKit.h>

@interface TestAppDelegate : NSObject <UIApplicationDelegate>
{
    UIWindow *window;
    IBOutlet UINavigationController *xNavi;
}
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) UINavigationController *xNavi;
@end
3.On your .m, synthesize and release the UINavigationController.
Code:
#import "TestAppDelegate.h"

@implementation TestAppDelegate
@synthesize window;
@synthesize xNavi;

- (void)applicationDidFinishLaunching:(UIApplication *)application
{
    [window makeKeyAndVisible];
}

- (void)dealloc
{
	[xNavi release];
    [window release];
    [super dealloc];
}
@end
***Very Important: Always save the changes you make. Like for this, you may not be able to link your UINavigationController to your AppDelegate if you didn't save the changes above before moving to the next step.

4.Now, open your MainWindow.xib, Open Tools->Library. Or simply press command+shift+L.

5.From the library, drag a Navigation Controller to your MainWindow.xib. It should be together with your File's Owner, First Responder, Test App Delegate and Window.

6.Select your newly added UINavigation Controller and Open Tools->Connection Inspecter (command+2).

7.Connect Your Referncing Outlets to Test App Delegate. The xNavi should appear there, select it.

8.Save everything and try to run it.

9.If you see a white screen, that is because we are still seeing the window. What we need to do is to add xNavi to window, like this:
Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
	[window addSubview:self.xNavi.view];
    [window makeKeyAndVisible];
}
10.Try running it now. The only thing left is to place a View on the View controller of your Navigation Controller.

11.This is how I do it so that it would not be a tableView Controller.

12.Add a new file on your classes.

13.Select "UIViewController subclass".

14.Check on "With XIB for user interface".

15.Click next, then name it whatever you like, then Finish.

16.You will now have 5 files under your classes, appdelegate.m and .h, the three new files .m, .h and it's .xib.

17.Open your MainWindow.xib, expand your Navigation Controller, (Change your View Mode into List so you can expand the Controller).

18.When you expand the Navigation Controller, you should be able to see the Navigation Bar and View Controller (Root View Controller).

19.Select the View Controller then press command+4.

20.On the Class, select the Drop-Down box and locate your View Controller, the one you created earlier. Save and Close your MainWindow.xib.

21.To test that your View Controller is now connected to your Navigation Controller, go to your View Controller .m. On it's viewDidLoad() make something like this:
Code:
- (void)viewDidLoad
{
    [super viewDidLoad];
	self.view.backgroundColor = [UIColor brownColor]; 
}
22.Run the program, you should now see a brown screen
__________________
Praise be to God

Last edited by Brix; 02-17-2010 at 09:59 PM.
Brix is offline   Reply With Quote
Old 02-17-2010, 09:04 PM   #5 (permalink)
Registered Member
 
Join Date: Feb 2010
Posts: 5
Default

Thanx a lot Brix!

That was a real time saver!!! Very well explained!
nasty_jpp is offline   Reply With Quote
Old 03-08-2010, 07:54 PM   #6 (permalink)
Registered Member
 
Join Date: Mar 2010
Posts: 1
Default

Hi I was interested by your question but I can't seem to view your images. I too am trying to do something very similar to this.
stevus is offline   Reply With Quote
Reply

Bookmarks

Tags
navigation controller

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: 330
22 members and 308 guests
@sandris, ADY, BrianSlick, dacapo, Dani77, Dattee, dre, HDshot, HemiMG, JasonR, MarkC, mer10, nibeck, prchn4christ, ryandb2, spiderguy84, themathminister, timle8n1, tomtom100, viniciusdamone, vogueestylee, vvenkatachallam
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,883
Threads: 89,229
Posts: 380,763
Top Poster: BrianSlick (7,129)
Welcome to our newest member, vvenkatachallam
Powered by vBadvanced CMPS v3.1.0

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