本文主要是介绍iOS 之app启动的过程、启动项launchscreen,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
***app启动过程:
默认情况下,app启动会加载main.storyboard; 工程-》General-》Main Interface中可以选择要显示的页面;
如果appdelegate中有了自定义的页面,就显示自定义的页面,自定义的页面的优先级高于Main Interface中的设置;主要的过程是走main.m中main方法;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
self.window=[[UIWindow alloc]initWithFrame:[UIScreen mainScreen].bounds];
self.window.backgroundColor=[UIColor whiteColor];
LYBTabBarVC *tabbarvc=[[LYBTabBarVC alloc]init];
self.window.rootViewController=tabbarvc;
[self.window makeKeyAndVisible];
return YES;
}
***launchscreen
launchImage:
1242x2208,-----
750x1334,----,
640x960,----
640x1136px;----
640*960 (4/4s) 2X位置
640*1136 (5/5s/5c) R4位置
750*1334 (6) R4.7位置
1242*2208 (6 plus) R5.5位置
[NSThread sleepForTimeInterval:3.0];//设置启动页面时间
UIViewController *viewController = [[UIStoryboard storyboardWithName:@"LaunchScreen"bundle:nil]instantiateViewControllerWithIdentifier:@"LaunchScreen"];
UIView *launchView = viewController.view;
UIWindow *mainWindow = [UIApplicationsharedApplication].keyWindow;
launchView.frame = [UIApplication sharedApplication].keyWindow.frame;
[mainWindow addSubview:launchView];
[UIView animateWithDuration:0.6f delay:0.5f options:UIViewAnimationOptionBeginFromCurrentState animations:^{
launchView.alpha = 0.0f;
launchView.layer.transform = CATransform3DScale(CATransform3DIdentity, 1.5f, 1.5f, 1.0f);
} completion:^(BOOL finished) {
[launchView removeFromSuperview];
}];
640*960 (4/4s) 2X位置
640*1136 (5/5s/5c) R4位置
750*1334 (6) R4.7位置
1242*2208 (6 plus) R5.5位置
这篇关于iOS 之app启动的过程、启动项launchscreen的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!