0

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

Trevor Wood
  • 2,347
  • 5
  • 31
  • 56
  • Have you tried `view.sendSubview(toBack: imageView)`? Set frame of `imageView.frame = CGRect(x: 0, y: 0, width: view.frame.width, height: yourHeight)` and then try to send it to back – mcgtrt May 30 '18 at 08:20
  • Possible duplicate of [Set Image Underlay of Transparent Navigation Bar and Status Bar in Swift iOS 8](https://stackoverflow.com/questions/31399166/set-image-underlay-of-transparent-navigation-bar-and-status-bar-in-swift-ios-8) – Ahmad F May 30 '18 at 08:27
  • @AhmadF This is not a duplicate because image is not in an imageview. It is in tableview cell. Given link answer won't work for this question – RajeshKumar R May 30 '18 at 08:37

1 Answers1

1

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.

RajeshKumar R
  • 15,445
  • 2
  • 38
  • 70