首页 > 代码库 > 状态栏的提示
状态栏的提示
状态栏的提示
by 伍雪颖
@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; }); }
状态栏的提示
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。