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 07-30-2009, 12:25 AM   #1 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 140
Post Switching Views Source Code

Hi there,
I'm have some trouble with the tutorial on how to switch views from iphonedevcentral.org. I have tried every thing, and I can't get it to work.
I was wondering if someone could post the source code. You can email it to me at ybrikeeg@yahoo.com

Thanks

Here is the URL:

Welcome to the iPhone Development Central Website!
ybrikeeg is offline   Reply With Quote
Old 07-30-2009, 01:18 AM   #2 (permalink)
Tutorial Author
 
Join Date: Jul 2009
Posts: 49
Default

http://www.iphonedevsdk.com/forum/ip...e-xib-how.html

http://www.iphonedevsdk.com/forum/ip...ple-views.html

2 Very easy too follow tutorials.
-MaXiMuM
MaXiMuM is offline   Reply With Quote
Old 07-30-2009, 02:03 PM   #3 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 140
Default

Quote:
Originally Posted by MaXiMuM View Post
Thanks for the reply MaXiMuM,
But what I'm looking for is how to have two different buttons take you to two different screens. I can't get that to work from a tutorial on how make one button take you to another screen. Any other help would be grealy appreciated.
ybrikeeg is offline   Reply With Quote
Old 07-30-2009, 02:38 PM   #4 (permalink)
Registered Member
 
Join Date: Jul 2009
Location: Raleigh, NC
Posts: 75
Default

Take a look at this video tutorial:

YouTube - iPhone SDk Tutorial - Switching ViewsControllers With Animation
bigdave1024 is offline   Reply With Quote
Old 07-30-2009, 03:46 PM   #5 (permalink)
Registered Member
 
Join Date: Jul 2009
Posts: 140
Default

Quote:
Originally Posted by bigdave1024 View Post
Thanks for you help, but I've already look at that tutorial. how would you get two buttons on the homescreen to take you to two different views? It must be different from the youtube tutorial because repeating the process doesn't work.
ybrikeeg is offline   Reply With Quote
Old 07-30-2009, 04:15 PM   #6 (permalink)
Registered Member
 
Join Date: Jul 2009
Location: Raleigh, NC
Posts: 75
Default

I am currently working on an app that utilizes this. In my mainViewController.h I have these 3 IBActions:

Code:
- (IBAction)loadSecondView:(id)sender;
- (IBAction)loadThirdView:(id)sender;
- (IBAction)loadFourthView:(id)sender;
So in my mainViewController.m is like so:

Code:
#import "mainViewController.h"
#import "SecondViewController.h"
#import "ThirdViewController.h"
#import "FourthViewController.h"

@implementation mainViewController

- (IBAction)loadSecondView:(id)sender {

     SecondViewController *Second = [[SecondViewController alloc] initWithNibName:nil bundle:nil];
     [self presentModalViewController: Second animated: YES];

}

- (IBAction)loadThirdView:(id)sender {

     ThirdViewController *Third = [[ThirdViewController alloc] initWithNibName:nil bundle:nil];
     [self presentModalViewController: Third animated: YES];

}

....// Same concept for Fourth view
Then you should be able to go into Interface Builder and create your mainViewController.xib with 3 buttons and connect each button to the correct function. And if you wanted to go back to the main menu you would use a function that calls [self dismissModalViewController: .... animated: YES] in each of your sub view controllers and link a button to the function that makes the call.
bigdave1024 is offline   Reply With Quote
Old 08-06-2009, 12:39 AM   #7 (permalink)
New Member
 
Join Date: Aug 2009
Posts: 3
Default

Quote:
Originally Posted by bigdave1024 View Post
I am currently working on an app that utilizes this. In my mainViewController.h I have these 3 IBActions:

Code:
- (IBAction)loadSecondView:(id)sender;
- (IBAction)loadThirdView:(id)sender;
- (IBAction)loadFourthView:(id)sender;
So in my mainViewController.m is like so:

Code:
#import "mainViewController.h"
#import "SecondViewController.h"
#import "ThirdViewController.h"
#import "FourthViewController.h"

@implementation mainViewController

- (IBAction)loadSecondView:(id)sender {

     SecondViewController *Second = [[SecondViewController alloc] initWithNibName:nil bundle:nil];
     [self presentModalViewController: Second animated: YES];

}

- (IBAction)loadThirdView:(id)sender {

     ThirdViewController *Third = [[ThirdViewController alloc] initWithNibName:nil bundle:nil];
     [self presentModalViewController: Third animated: YES];

}

....// Same concept for Fourth view
Then you should be able to go into Interface Builder and create your mainViewController.xib with 3 buttons and connect each button to the correct function. And if you wanted to go back to the main menu you would use a function that calls [self dismissModalViewController: .... animated: YES] in each of your sub view controllers and link a button to the function that makes the call.

Using this method doesn't it auto instantiate All your subviews automatically when the root view is created? The app I'm working on myself has 8 views and a few views have custom picker controls, seems like this would be bad for memory..

I'm trying to figure out how to do creation dynamically with a rootViewController myself, but I'm kinda stuck on how exactly to switch. I've seen some suggestions to use the notification API and have the root controller listen for it. With this I'm stuck with I won't know which view is calling the display for the new view so I can release it and load the new one.

anyone have any additional suggesstions on this subject?
davidmirv is offline   Reply With Quote
Reply

Bookmarks

Tags
help!, source code, switching views

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: 237
16 members and 221 guests
@sandris, ADY, Alsahir, dacapo, Dani77, djohnson, HemiMG, jansan, JasonR, MarkC, mer10, prchn4christ, ryandb2, smethorst, tomtom100
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,882
Threads: 89,228
Posts: 380,762
Top Poster: BrianSlick (7,129)
Welcome to our newest member, jansan
Powered by vBadvanced CMPS v3.1.0

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