Hey Guys, I am having trouble with the modalTransistionStyle function. I have 2 views (QuizView and LessonView). The modalTransistionStyle function works on the QuizView but not in the LessonView. For the LessonView, I have another file called LessonNavigator to enable the navigation bar. It basically has a navigation bar at the top and then loads a LessonView in the body. I'm thinking maybe that is causing the modalTransistionStyle to not work properly. Can someone tell me how to fix this?
Here's my code in the mainView
This is my LessonNavigator.h
This is my LessonNavigator.m
Here's my code in the mainView
PHP:
- (void)quizViewControllerDidFinish:(QuizViewController *)quiz{
[self dismissModalViewControllerAnimated:YES];
}
- (IBAction)loadQuiz:(id)sender {
QuizViewController *quiz = [[QuizViewController alloc] initWithNibName:@"QuizViewController" bundle:nil];
quiz.delegate = self;
quiz.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:quiz animated:YES];
[quiz release];
}
- (void)lessonNavigatorDelegateDidFinish:(LessonNavigator *)lessonNavigator {
[self dismissModalViewControllerAnimated:YES];
}
- (IBAction)loadLessonNavigator:(id)sender {
LessonNavigator *lessonNavigator = [[LessonNavigator alloc] initWithNibName:@"LessonNavigator" bundle:nil];
lessonNavigator.delegate = self;
lessonNavigator.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
[self presentModalViewController:lessonNavigator animated:YES];
[lessonNavigator release];
}
This is my LessonNavigator.h
PHP:
@protocol LessonNavigatorDelegate;
@interface LessonNavigator : UIViewController{
id <LessonNavigatorDelegate> delegate;
UIWindow *window;
UINavigationController *navigationController;
}
@property (nonatomic, retain) id <LessonNavigatorDelegate> delegate;
@property (nonatomic, retain) IBOutlet UIWindow *window;
@property (nonatomic, retain) IBOutlet UINavigationController *navigationController;
- (IBAction)back:(id)sender;
@end
@protocol LessonNavigatorDelegate
- (void)lessonNavigatorDelegateDidFinish:(LessonNavigator *)lessonNavigator;
@end
This is my LessonNavigator.m
PHP:
@implementation LessonNavigator
@synthesize window;
@synthesize navigationController;
@synthesize delegate;
/*
// The designated initializer. Override if you create the controller programmatically and want to perform customization that is not appropriate for viewDidLoad.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Custom initialization
}
return self;
}
*/
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
}
- (IBAction)back:(id)sender {
[self.delegate lessonNavigatorDelegateDidFinish:self];
}
/*
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}
*/
- (void)didReceiveMemoryWarning {
// Releases the view if it doesn't have a superview.
[super didReceiveMemoryWarning];
// Release any cached data, images, etc that aren't in use.
}
- (void)viewDidUnload {
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}
- (void)dealloc {
[navigationController release];
[window release];
[super dealloc];
}
@end