ios淡出闪屏(iphone 5友好) [英] ios fade out splash screen (iphone 5 friendly)
问题描述
每当调用 applicationDidBecomeActive
时,我想要欺骗主闪屏的感觉,但它无法正常工作。我做错了什么?
I'm wanting to spoof the feel of the main splash screen fading out whenever applicationDidBecomeActive
is called, but it's not working. What am I doing wrong?
- (void)applicationDidBecomeActive:(UIApplication *)application
{
if(IS_IPHONE_5)
splash = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Default-568h.png"]];
else
splash = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Default.png"]];
[self.window.rootViewController.view addSubview:splash];
[UIView animateWithDuration:0.5
animations:^{
splash.alpha = 0;
}
completion:^(BOOL finished) {
[splash removeFromSuperview];
}];
}
然后你需要在某处定义以下内容。我使用项目 .pch
,但如果需要,可以使用标题。
Then you need to define the following somewhere. I use the project .pch
but you can use your header if you want.
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )
推荐答案
如果这确实是您的代码,您可能在图像名称中输入了拼写错误。 (如果没有,请告诉我们不工作的含义。)
If that is really your code, you probably have a typo in the image name. (If not, let us know what "not working" means.)
此外,每个 applicationDidBecomeActive通常不会出现启动画面:
。 didFinishLaunchingWithOptions:
是您知道自己已经启动并且代表您显示启动画面的时间。
Also, the splash screen doesn't normally come up every applicationDidBecomeActive:
. didFinishLaunchingWithOptions:
is the time you know that you have been launched and the splash screen had been shown on your behalf.
这篇关于ios淡出闪屏(iphone 5友好)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!