UIWindow *window = [UIApplication sharedApplication].keyWindow;
window.windowLevel = UIWindowLevelStatusBar;
//自定义状态栏内容
UIView *view1 = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 320, 20)];
view1.backgroundColor = [UIColor grayColor];
UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 100, 20)];
label.text = @"status bar";
[view1 addSubview:label];
[window addSubview:view1];
注意:当在为当前窗口的rootViewController重新设置值时需要重新添加