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

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

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

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.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-06-2010, 03:07 PM   #1 (permalink)
Mobile Apps Developer
 
JoeRCruso's Avatar
 
Join Date: Oct 2010
Posts: 24
JoeRCruso is on a distinguished road
Question Switching Views With a UITabBar Application Problem

So I have an application that is supposed to have a tab bar at the bottom and after you tap each tab bar item, it goes to another view, but the tab bar remains at the bottom. In the first tab, I've got some buttons. Each button is supposed to go to another view that slides up from the bottom. These views don't have a tab bar. They will take up the whole screen. So far only one button works. This was easy to set up.


In the .h of the main view (with the tab bar):

Code:
#import <UIKit/UIKit.h>

@class IntroViewController;

@interface FirstViewController : UIViewController {
	
	IBOutlet IntroViewController *introView;
	
}

- (IBAction)intro;

@end

In the .m:

Code:
#import "FirstViewController.h"


@implementation FirstViewController

- (IBAction)intro {
	
	[self presentModalViewController:introView animated:YES];
	
}

- (void)dealloc {
    [super dealloc];
}

@end
So, the view does slide up from the bottom like I expected.


But, the problem i don't know how to fix is when the done button in the Intro View is tapped, for it to go "back" to the main view with the tab bar. What I really mean by back is for the main view to slide up like the Intro View did, so the main view is being presented instead of the Intro View sliding back down.

For example, I don't use this:

Code:
[self.parentViewController dismissModalViewControllerAnimated:YES];
I use this:

Code:
[self presentModalViewController:mainView animated:YES];
I'm pretty sure I hooked up everything correctly, but when I click the Back button, nothing happens. No crashing, no freezing, just nothing.


Here's all my code, if you'd like to see it:

In the .h of the main view (the view with the tab bar):


Code:
#import <UIKit/UIKit.h>

@class IntroViewController;

@interface FirstViewController : UIViewController {
	
	IBOutlet IntroViewController *introView;
	
}

- (IBAction)intro;
- (IBAction)stepOne;
- (IBAction)stepTwo;
- (IBAction)stepThree;

@end

In the .m:

Code:
#import "FirstViewController.h"


@implementation FirstViewController

- (IBAction)intro {
	
	[self presentModalViewController:introView animated:YES];
	
}

- (IBAction)stepOne {
	
}

- (IBAction)stepTwo {
		
}

- (IBAction)stepThree {
	
}


- (void)dealloc {
    [super dealloc];
}

@end

In the .h of the Intro View:

Code:
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>

@class FirstViewController;

@interface IntroViewController : UIViewController {
	
	IBOutlet FirstViewController *mainView;

}

- (IBAction)back;

@end

In the .m:

Code:
#import "IntroViewController.h"

@implementation IntroViewController


- (IBAction)back {
	
	[self presentModalViewController:mainView animated:YES];
	
}

@end

So... What am I doing wrong??? I'm somewhat new to objective-c and iPhone development, so please give me an example with code. Thanks!
JoeRCruso is offline   Reply With Quote
Old 11-06-2010, 05:04 PM   #2 (permalink)
Registered Member
 
Join Date: Sep 2010
Posts: 97
hodgey87 is on a distinguished road
Default

not sure if this is any good, but this is how i go back to the main screen on my game.

Quote:
- (IBAction)backButtonPressed{
KeepyViewController *gamesview = [[KeepyViewController alloc] initWithNibName:nil bundle:nil];

gamesview.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:gamesview animated:YES];
}
hodgey87 is offline   Reply With Quote
Reply

Bookmarks

Tags
back, switch views, tab bar, uitabbar, uitabbarcontroller

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: 348
10 members and 338 guests
7twenty7, chiataytuday, condor304, Creativ, Domele, dreamdash3, laureix68, LEARN2MAKE, mistergreen2011, Paul Slocum
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,660
Threads: 94,119
Posts: 402,896
Top Poster: BrianSlick (7,990)
Welcome to our newest member, laureix68
Powered by vBadvanced CMPS v3.1.0

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