给大家介绍如何实现 iOS 自定义状态栏
Sample Code:
01 |
UIWindow * statusWindow = [[UIWindow alloc] initWithFrame:[UIApplication sharedApplication].statusBarFrame]; |
02 |
[statusWindow setWindowLevel:UIWindowLevelStatusBar + 1];
|
03 |
[statusWindow setBackgroundColor:[UIColor clearColor]];
|
04 |
|
05 |
UILabel * statusLabel = [[UILabel alloc] initWithFrame:statusWindow.bounds];
|
06 |
statusLabel.text = @ "RSSI:" ;
|
07 |
statusLabel.textColor = [UIColor blueColor];
|
08 |
statusLabel.textAlignment = NSTextAlignmentCenter;
|
09 |
statusLabel.backgroundColor = [UIColor blackColor];
|
10 |
|
11 |
[statusWindow addSubview:statusLabel];
|
12 |
|
13 |
[statusWindow makeKeyAndVisible];
|