gpt4 book ai didi

iphone - 启动画面图像的方向不正确

转载 作者:行者123 更新时间:2023-11-29 04:42:53 25 4
gpt4 key购买 nike

我想使用自定义启动屏幕,所以我在我的应用程序委托(delegate)中执行此操作

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {    

// Override point for customization after application launch.

homeNavigationController = [[UINavigationController alloc] init];
homeNavigationController.navigationBarHidden = NO;

[homeNavigationController pushViewController:viewController animated:NO];

// Add the view controller's view to the window and display.
[window addSubview:homeNavigationController.view];
[window makeKeyAndVisible];

[self animateSplash];

return YES;
}

- (void)animateSplash {

CGRect cgRect = [[UIScreen mainScreen] bounds];
CGSize cgSize = cgRect.size;

// set default portrait for now, will be updated if necessary
NSString *imageName = @"splash_screen.png";
CGRect imageFrame = CGRectMake( 0, 0, cgSize.width, cgSize.height );

imageStage = [[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]];
imageStage.frame = imageFrame;


[window addSubview:imageStage];
[window bringSubviewToFront:imageStage];

[UIView beginAnimations:nil context:nil];
[UIView setAnimationDelay:2];
[UIView setAnimationDuration:3.0f];
[UIView setAnimationTransition:UIViewAnimationTransitionNone forView:window cache:YES];
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(startupAnimationDone:finished:context:)];

imageStage.alpha = 0.0f;

[UIView commitAnimations];
}

- (void)startupAnimationDone:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context {

// remove and clean up splash image view
[imageStage removeFromSuperview];
[imageStage release];
imageStage = nil;

}

这工作正常,但由于我的应用程序是在横向(主页按钮右侧)模式下启动,所以我的启动图像方向设置不正确。

最佳答案

只需使用经过旋转的图像即可在您的方向上看起来正确。

如果您出于某种原因确实想在代码中执行此操作,请查看 How to Rotate a UIImage 90 degrees?了解旋转 UIImage 的不同方式。

关于iphone - 启动画面图像的方向不正确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10095377/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com