I’m sorry I posted the wrong files here are the correct ones.
I am stuck and need HELP. I wish to use one view in portrait and a DIFFERENT view in landscape.
“Show different views for portrait and landscape positions. Like, showing view A (in UIInterfaceOrientationPortrait and UIInterfaceOrientationPortraitUpsideDown), rotate device, then showing view B in (UIInterfaceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeRight).”
Using the view controller orientation support. I have Two issues I’m unable to resolve.
*
When I rotate from portrait to landscape OR landscape to portrait there is a white screen showing during animation.
When I rotate to landscape second view appears. However, when I rotate back to portrait the second view remains and the first view doesn’t load. Second view remains and doesn't go away.
*
Second view files have no changes from what is given when creating them.
*
*
Here is my first view files.
iPadViewTestViewController.h
iPadViewTestViewController.m
I am stuck and need HELP. I wish to use one view in portrait and a DIFFERENT view in landscape.
“Show different views for portrait and landscape positions. Like, showing view A (in UIInterfaceOrientationPortrait and UIInterfaceOrientationPortraitUpsideDown), rotate device, then showing view B in (UIInterfaceOrientationLandscapeLeft and UIInterfaceOrientationLandscapeRight).”
Using the view controller orientation support. I have Two issues I’m unable to resolve.
*
When I rotate from portrait to landscape OR landscape to portrait there is a white screen showing during animation.
When I rotate to landscape second view appears. However, when I rotate back to portrait the second view remains and the first view doesn’t load. Second view remains and doesn't go away.
*
Second view files have no changes from what is given when creating them.
*
*
Here is my first view files.
iPadViewTestViewController.h
Code:
#import <UIKit/UIKit.h>
@class LandscapeViewController;
@interface iPadViewTestViewController : UIViewController {
iPadViewTestViewController *viewController;
LandscapeViewController *landscapeViewController;
}
@property (nonatomic, retain) iPadViewTestViewController *viewController;
@property (nonatomic, retain) LandscapeViewController *landscapeViewController;
@end
iPadViewTestViewController.m
Code:
#import "iPadViewTestViewController.h"
#import "LandscapeViewController.h"
@implementation iPadViewTestViewController
@synthesize viewController;
@synthesize landscapeViewController;
/*
// The designated initializer. Override to perform setup that is required before the view is loaded.
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil {
if ((self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])) {
// Custom initialization
}
return self;
}
*/
/*
// Implement loadView to create a view hierarchy programmatically, without using a nib.
- (void)loadView {
}
*/
/*
// Implement viewDidLoad to do additional setup after loading the view, typically from a nib.
- (void)viewDidLoad {
[super viewDidLoad];
}
*/
// Override to allow orientations other than the default portrait orientation.
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation {
return YES;
}
- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation) interfaceOrientation duration:(NSTimeInterval)duration {
if (interfaceOrientation == UIInterfaceOrientationPortrait || interfaceOrientation ==
UIInterfaceOrientationPortraitUpsideDown) {
self.view;
} else if (interfaceOrientation == UIInterfaceOrientationLandscapeLeft || interfaceOrientation ==
UIInterfaceOrientationLandscapeRight) {
//NSLog (@"landscape did get called");
LandscapeViewController *landscape = [[LandscapeViewController alloc] initWithNibName:@"Landscape" bundle:nil];
[self setLandscapeViewController:landscape];
[landscape release];
[viewController.view removeFromSuperview];
[self.view addSubview:landscapeViewController.view];
[UIView commitAnimations];
}
}
- (void)viewDidLoad {
[super viewDidLoad];
}
- (void)viewDidAppear:(BOOL)animated {
}
- (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 {
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
self.landscapeViewController = nil;
}
- (void)dealloc {
[super dealloc];
}
@end