代码:
RootViewController.m
#import "RootViewController.h" @interface RootViewController () @end @implementation RootViewController - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization } return self; } - (void)viewDidLoad { [super viewDidLoad]; // Do any additional setup after loading the view. self.title=@"UIStatus"; //动画效果 [UIView animateWithDuration:3 animations:^{ [self setNeedsStatusBarAppearanceUpdate]; }]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; // Dispose of any resources that can be recreated. } #pragma mark IOS 7 UIStatusBar //动画效果 -(UIStatusBarAnimation)preferredStatusBarUpdateAnimation { return UIStatusBarAnimationFade; } //样式 -(UIStatusBarStyle)preferredStatusBarStyle { return UIStatusBarStyleDefault; } //显示和隐藏 -(BOOL)prefersStatusBarHidden { return FALSE; } @end
时间: 2024-10-24 11:41:42