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!