如何实现 iOS 自定义状态栏

给大家介绍如何实现 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];
posted @ 2013-07-03 20:22  爱生活,爱编程  阅读(456)  评论(0编辑  收藏  举报