【问题标题】:change the background of the statusbar with rubymotion使用 ruby​​motion 更改状态栏的背景
【发布时间】:2014-01-23 21:16:31
【问题描述】:

我尝试像这样更改状态栏的背景

但是任何尝试都失败了,我不知道我是否使用了很好的方法。

限制是navigationBar应该被隐藏,否则我不能这样做,不知道是不是因为ca我不能改变statusBar的背景。

谢谢

【问题讨论】:

    标签: ios7 statusbar rubymotion


    【解决方案1】:

    我将采用 this StackOverflow answer 并将其改编为 RubyMotion。

    if UIDevice.currentDevice.systemVersion.to_f >= 7.0
      view = UIView.alloc.initWithFrame([[0, 0], [320, 20]])
      view.backgroundColor = UIColor.colorWithRed(0/255.0, green:0/255.0, blue:0/255.0, alpha:1.0)
      self.window.rootViewController.view.addSubview(view)
    end
    

    【讨论】:

    • 如果你在 ViewController 中调用,你可以用 self.view.addSubview(view) 替换 self.window.rootViewController.view.addSubview(view);在这种情况下,您可以自定义每个 VC 的背景
    猜你喜欢
    • 2015-09-26
    • 2016-11-30
    • 2019-11-05
    • 2019-11-20
    • 2016-10-16
    • 2015-10-09
    • 1970-01-01
    • 2012-02-21
    • 2017-02-09
    相关资源
    最近更新 更多