Search code examples
ios7statusbarrubymotion

change the background of the statusbar with rubymotion


I try to change the background of the statusBar like this enter image description here

but any attempt fails and I do not know if I use well good method.

the constraint is that the navigationBar should be hidden and I can not do otherwise, and I do not know if it's because of ca that I can not change the background of the statusBar.

thank you


Solution

  • I'll take this StackOverflow answer and adapt it for 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