ios LaunchImage的延迟方法
Posted Tony0571
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了ios LaunchImage的延迟方法相关的知识,希望对你有一定的参考价值。
1. 使用线程 延迟
在第一个加载页面
ViewDidLoad {
[NSThread sleepForTimeInterval:3];
}
2.使用动画
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
ViewController *ctr = [[ViewController alloc] init];
UINavigationController *navi = [[UINavigationController alloc] initWithRootViewController:ctr];
self.window.rootViewController = navi;
[self.window makeKeyAndVisible];
NSString *viewOrientation = @"Portrait";
CGSize viewSize = self.window.bounds.size;
NSString *launchImg = nil;
NSArray *imgDict = [[[NSBundle mainBundle] infoDictionary] valueForKey:@"UILaunchImages"];
for (NSDictionary *dic in imgDict) {
CGSize imgSize = CGSizeFromString(dic[@"UILaunchImageSize"]);
if (CGSizeEqualToSize(imgSize, viewSize) && [viewOrientation isEqualToString:dic[@"UILaunchImageOrientation"]]) {
launchImg = dic[@"UILaunchImageName"];
}
}
UIImageView *launchView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"123"]];
launchView.frame = self.window.bounds;
launchView.contentMode = UIViewContentModeScaleToFill;
[self.window addSubview:launchView];
[UIView animateWithDuration:5 delay:0.5 options:UIViewAnimationOptionBeginFromCurrentState animations:^{
launchView.alpha =0.0f;
launchView.layer.transform = CATransform3DScale(CATransform3DIdentity, 1.2, 1.2, 1);
} completion:^(BOOL finished) {
[launchView removeFromSuperview];
}];
return YES;
}
以上是关于ios LaunchImage的延迟方法的主要内容,如果未能解决你的问题,请参考以下文章
iOS图标(AppIcon)与启动图(LaunchImage)
Xcode 7:iOS 9 模拟器上没有 launchImage