码迷,mamicode.com
首页 > 其他好文 > 详细

状态栏的提示

时间:2014-12-12 16:43:26      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:ios

状态栏的提示

by 伍雪颖

bubuko.com,布布扣
@property (nonatomic, strong) UIWindow *window;
@property (nonatomic, strong) UILabel *meterLabel;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.window = [[UIWindow alloc] initWithFrame:[UIApplication sharedApplication].statusBarFrame];
    self.window.windowLevel = UIWindowLevelStatusBar + 10.0;
    self.window.userInteractionEnabled = NO;
    
    CGFloat const kMeterWidth = 165.0;
    self.meterLabel = [[UILabel alloc] initWithFrame:CGRectMake((CGRectGetWidth(self.window.bounds) - kMeterWidth) / 2.0, 0.0,
                                                                kMeterWidth, CGRectGetHeight(self.window.bounds))];
    self.meterLabel.font = [UIFont boldSystemFontOfSize:12.0];
    self.meterLabel.backgroundColor = [UIColor blackColor];
    self.meterLabel.textColor = [UIColor whiteColor];
    self.meterLabel.textAlignment = NSTextAlignmentCenter;
    self.meterLabel.text = @"touch here to go back";
    [self.window addSubview:self.meterLabel];
    self.window.hidden = NO;
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        self.window = nil;
    });
}


状态栏的提示

标签:ios

原文地址:http://blog.csdn.net/rainlesvio/article/details/41894467

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!