我想在调用applicationDidBecomeActive
时模拟主启动屏幕淡出的感觉,但是它没有起作用。我做错了什么?
- (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
,但如果您愿意,可以使用您自己的头文件。
#define IS_IPHONE_5 ( fabs( ( double )[ [ UIScreen mainScreen ] bounds ].size.height - ( double )568 ) < DBL_EPSILON )