1、在ViewController中操作当前ViewController的状态栏
/** 隐藏状态栏 */ override func prefersStatusBarHidden() -> Bool { return true; } /** 设置状态栏风格 */ override func preferredStatusBarStyle() -> UIStatusBarStyle { return UIStatusBarStyle.LightContent; }
2.在AppDelegate中设置状态栏
func setupWithStatusBar(application: UIApplication) { // 设置状态栏隐藏 application.statusBarHidden = true; application.setStatusBarHidden(true, withAnimation: UIStatusBarAnimation.Fade); // 设置状态栏高亮 application.statusBarStyle = UIStatusBarStyle.LightContent; application.setStatusBarStyle(UIStatusBarStyle.LightContent, animated: true); }
原文:http://www.cnblogs.com/machao/p/4987040.html