相关疑难解决方法(0)

如何在Swift iOS应用程序中隐藏状态栏?

我想删除屏幕顶部的状态栏.

这不起作用:

func application
(application: UIApplication,
didFinishLaunchingWithOptions launchOptions: NSDictionary?)
-> Bool
{
        application.statusBarHidden = true
        return true
}
Run Code Online (Sandbox Code Playgroud)

我也尝试过:

func application
(application: UIApplication,
didFinishLaunchingWithOptions launchOptions: NSDictionary?)
-> Bool
{
    self.window = UIWindow(frame: UIScreen.mainScreen().bounds)

    var controller = UIViewController()
    application.statusBarHidden = true
    controller.setNeedsStatusBarAppearanceUpdate()

    var view = UIView(frame: CGRectMake(0, 0, 320, 568))
    view.backgroundColor = UIColor.redColor()
    controller.view = view

    var label = UILabel(frame: CGRectMake(0, 0, 200, 21))
    label.center = CGPointMake(160, 284)
    label.textAlignment = NSTextAlignment.Center
    label.text = "Hello World"
    controller.view.addSubview(label)

    self.window!.rootViewController = controller
    self.window!.makeKeyAndVisible()
    return …
Run Code Online (Sandbox Code Playgroud)

iphone ios ios7 swift

191
推荐指数
13
解决办法
13万
查看次数

标签 统计

ios ×1

ios7 ×1

iphone ×1

swift ×1