赞
踩
目录
·main函数前
动态链接 / 二进制文件加载 / runtime / 类的加载 ......
·main函数
- int main(int argc, char * argv[]) {
- NSString * appDelegateClassName;
- @autoreleasepool {
- // Setup code that might create autoreleased objects goes here.
- appDelegateClassName = NSStringFromClass([AppDelegate class]);
- }
- return UIApplicationMain(argc, argv, nil, appDelegateClassName);
- }
创建UIApplication对象(系统功能) 创建对应的delegate实现业务逻辑
·处理App生命周期 / 系统内存警告
·处理UI / statusbar / 图标消息数等状态的变化 / 方向
·处理openURL
·提供Delegate / Notification两种方式处理业务逻辑
·根据App状态调整业务逻辑
·Not running
·Inactive:中间的过渡状态
·Active:正在前台运行,系统分配更多资源
·Background:分配较少的资源
·Suspended:内存不足系统自动Kill
·启动前图片的组成
·Launch Screen + Splash Screen
·Launch Screen启动屏(系统级)
·是Main函数之前 + didFinishLaunch前
·系统启动App时自动展示
·在准备好App UI数据后自动消失
·给用户以响应,确定点击了正确的图标
·Splash Screen闪屏(业务逻辑)
·Launch Screen展示时间短,看不清
·实现同样的图片,显示图标等信息
·实现广告 / 推广活动页面
·实现游戏中Loading页面
使用Xcode配置图片:
·分别上传对应设备2x 3x的图片
·系统自动展示和消失
直接在当前Window上addSubview
页面结构保证在最上面
创建新的Window成为KeyWindow
调整window的level
多Window的管理
点击跳过或三秒钟后自动跳过
- //
- // GSCSplashView.m
- // GSCApp1
- //
- // Created by gsc on 2024/6/15.
- //
-
- #import "GSCSplashView.h"
- #import "GSCScreen.h"
-
-
- @interface GSCSplashView()
-
- @property(nonatomic,strong,readwrite)UIButton *button;
- @property(nonatomic,strong,readwrite)NSTimer *timer;
-
- @end
-
- @implementation GSCSplashView
-
- -(instancetype)initWithFrame:(CGRect)frame{
- self = [super initWithFrame:frame];
- if(self){
- self.image = [UIImage imageNamed:@"icon.bundle/splash.png"];
- [self addSubview:({
- _button = [[UIButton alloc] initWithFrame:UIRectAdapter(330, 100, 60, 40)];
- _button.backgroundColor = [UIColor lightGrayColor];
- [_button setTitle:@"跳过" forState:UIControlStateNormal];
- [_button addTarget:self action:@selector(_removeSplashView) forControlEvents:UIControlEventTouchUpInside];
- _timer = [NSTimer scheduledTimerWithTimeInterval:3.0 target:self selector:@selector(_removeSplashView) userInfo:nil repeats:NO];
- _button;
- })];
- self.userInteractionEnabled = YES;
- }
- return self;
- }
-
- #pragma mark -
-
- -(void)_removeSplashView{
- [self removeFromSuperview];
- }
-
- @end
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。