我在 iPad 应用程序中工作。我有 4 张用于启动画面的图像(横向右侧、左侧和纵向、纵向上下)。当我在纵向模式下启动应用程序时,启动画面看起来不错,但我将方向更改为 Landscaper,启动画面不会改变它们的方向。你能建议我任何想法吗?今天我需要提交应用程序。请帮我。提前致谢。这是我的代码,
-(void) showSplash
{
UIInterfaceOrientation orientation= [[UIApplication sharedApplication] statusBarOrientation];
if (orientation == UIInterfaceOrientationLandscapeLeft ||
orientation == UIInterfaceOrientationLandscapeRight) // UIDeviceOrientationLandscapeLeft
{
NSLog(@"Splash Landscape");
UIViewController *splash=[[UIViewController alloc] init];
splachview=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 1024, 768)];
splachview.image=[UIImage imageNamed:@"Default-Landscape.png"];
[splash.view addSubview:splachview];
splachview.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
splachview.contentMode = UIViewContentModeTop;
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
[self presentModalViewController:splash animated:NO];
[self performSelector:@selector(hideSplash) withObject:nil afterDelay:10.0];
[splash release];
[splachview release];
}
else if (orientation == UIInterfaceOrientationPortrait ||
orientation == UIInterfaceOrientationPortraitUpsideDown) // UIDeviceOrientationPortrait
{
NSLog(@"Splash Portrait");
UIViewController *splash=[[UIViewController alloc] init];
splachview=[[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 768, 1024)];
splachview.image=[UIImage imageNamed:@"Default-Portrait.png"];
[splash.view addSubview:splachview];
splachview.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;
splachview.contentMode = UIViewContentModeTop;
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:NO];
[self presentModalViewController:splash animated:NO];
[self performSelector:@selector(hideSplash) withObject:nil afterDelay:10.0];
[splash release];
[splachview release];
}
}
请纠正我的错误。闪屏不会改变它的方向。谢谢。