Here is some example code
#import "The_Ride_Vol_1ViewController.h"
#import "s0.h"
#import "p1.h"
#import "p2.h"
@implementation p1
@synthesize landscapeViewController, imageScrollView;
- (void)dealloc
{
//[[NSNotificationCenter defaultCenter] removeObserver:self];
// [[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
[landscapeViewController release];
[imageScrollView release];
[super dealloc];
}
- (void)willAnimateRotationToInterfaceOrientation

U IInterfaceOrientation)interfaceOrientation duration

NSTimeInterval)duration{
if(self.interfaceOrientation == UIDeviceOrientationPortrait || self.interfaceOrientation == UIDeviceOrientationLandscapeRight){
s0 *viewController = [[s0 alloc] init];
self.landscapeViewController = viewController;
[viewController release];
[self presentModalViewController:landscapeViewController animated:YES];
//setup your interface for portrait
} else if(self.interfaceOrientation == UIDeviceOrientationLandscapeLeft || self.interfaceOrientation == UIDeviceOrientationPortrait){
[landscapeViewController dismissModalViewControllerAnimated:YES];
//setup your interface for landscape
}
}
- (IBAction)goToSecondController{
p2 *controller = [[p2 alloc] initWithNibName:@"p2" bundle:nil];
controller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:controller animated:YES];
[controller release];
}
- (IBAction)goToFirstController{
The_Ride_Vol_1ViewController *controller = [[The_Ride_Vol_1ViewController alloc] initWithNibName:@"The_Ride_Vol_1ViewController" bundle:nil];
controller.modalTransitionStyle = UIModalTransitionStyleCrossDissolve;
[self presentModalViewController:controller animated:YES];
[controller release];
}
- (BOOL)shouldAutorotateToInterfaceOrientation

UIIn terfaceOrientation)interfaceOrientation
{
return YES; // support only portrait
}
@end