Trevor
Trevor

Reputation: 2457

iOS non blocking status bar

I'm trying to place an image behind the status bar.

I'm able to turn it transparent but It's still blocking the image from appearing behind it.

Does anybody know how to make the status bar apart of the editable screen and/or safe area? I don't want to delete it, just want to put stuff behind it.

Here's what IB looks like enter image description here

Code

override func viewWillAppear(_ animated: Bool) {
        setNeedsStatusBarAppearanceUpdate()
    }

    override func viewDidLoad() {
        super.viewDidLoad()
        venueInfoTableView.dataSource = self
        venueInfoTableView.delegate = self

        // Do any additional setup after loading the view, typically from a nib.

        venueInfoTableView.separatorStyle = .none
    }

    override var preferredStatusBarStyle : UIStatusBarStyle {
        return UIStatusBarStyle.lightContent
        //return UIStatusBarStyle.default   // Make dark again
    }

And here's the result

enter image description here

Upvotes: 0

Views: 78

Answers (1)

RajeshKumar R
RajeshKumar R

Reputation: 15758

You should disable automaticallyAdjustsScrollViewInsets

if #available(iOS 11.0, *) {               
  self.venueInfoTableView.contentInsetAdjustmentBehavior = .never
} else {
  self.automaticallyAdjustsScrollViewInsets = false
}

contentInsetAdjustmentBehavior This property specifies how the safe area insets are used to modify the content area of the scroll view. The default value of this property is automatic.

Upvotes: 1

Related Questions