1

I got the viewController with 2 elements:

  1. view with labels and buttons
  2. tableView

I'm getting the following animation by changing view's height constraint from 170 to 0 and than animating view.layoutIfNeeded() and tableView.layoutIfNeeded().

My goal is to hide menu when content offset of the tableView reaches some value.

This works fine, except I got an overlay of status bar over the moving content from my view. Are there any options to add a sublayer to status bar not to be transparent? Or any other suggestions?

Thanks!

Animation scene

rmaddy
  • 314,917
  • 42
  • 532
  • 579
oleskii
  • 366
  • 3
  • 14
  • 4
    you can out a put a solid black `20pt` high view there which makes the illusion the statusbar's transparency is gone; but for `UITableView` I would rather recommend to set the content edge inset by `(20.0, 0.0, 0.0, 0.0)`, which is a much more elegant solution. – holex Dec 17 '15 at 17:08
  • ^ What holex said. If you check out UIApplication documentation there is nothing about changing the background for status bar. https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIApplication_Class/ – boidkan Dec 17 '15 at 17:14

1 Answers1

3

Create a view, put it where the status bar will be, and set its background color to which ever color you require. For example:

let statusBarView = UIView(frame: UIApplication.sharedApplication().statusBarFrame)
statusBarView.backgroundColor = UIColor.blackColor()
view.addSubview(statusBarView)

Or, set the content edge inset by (20.0, 0.0, 0.0, 0.0), which I would agree is a much more elegant solution, as suggested by @holex in the comments

Daniel Storm
  • 18,301
  • 9
  • 84
  • 152