UIWindow+BBALevelManager.h
1.49 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
//
// UIWindow+BBALevelManager.h
// rotation
//
// Created by liuchengqing01 on 2017/9/29.
// Copyright © 2017年 baidu. All rights reserved.
//
#import <UIKit/UIKit.h>
/*
windowLevel default = 0.0
UIWindowLevelNormal 0
UIWindowLevelStatusBar 1000
UIWindowLevelAlert 2000
*/
// 自定义level尽量在UIWindowLevelAlert以下避免影响权限alert的使用
typedef NS_ENUM(NSUInteger, BBAWindowLevel) {
BBAWindowLevelSplash = 1400, //闪屏
BBAWindowLevelToast = 1300, //toast提醒
BBAWindowLevelAlert = 1200, //弹窗提醒
BBAWindowLevelSuspension = 1100, //悬浮窗(新特性)
BBAWindowLevelStatusBar = 1000, //状态栏
BBAWindowLevelAudioPlayer = 999, //全局音频播放器
BBAWindowLevelNightMask = 1, //夜间模式(临时定为1与现有逻辑一致)
BBAWindowLevelNormal = 0,
};
/*
不建议使用makeKeyAndVisible,
1.keyWindow主要负责接受键盘事件与非点击事件, 而点击事件会根据window的leave进行响应
2.非keyWindow上的textField等也可以通过点击与代码设置为firstRespond
3.keyWindow同一时间只允许存在一个, 抢占keyWindow导致[UIApplication sharedApplication].keyWindow取不到app的主Window
*/
@interface UIWindow (BBALevelManager)
- (void)bba_show;
- (void)bba_disappear;
- (BOOL)bba_isShowed;
- (void)bba_showAsLevel:(BBAWindowLevel)level;
- (void)bba_showAboveWindow:(UIWindow *)window;
- (void)bba_showBlowWindow:(UIWindow *)window;
@end