3

Scenario

I have an app that allows users to scroll up on a UITableView to view posts. When they scroll up the navigation bar will hide. I use the code from the following SO post...

Imitate iOS 7 Facebook hide/show expanding/contracting Navigation Bar

Problem

When I tried the first answer on there it worked the first time I used it, perfectly. After I got it to where it was working I tried to get my Tab Bar to drop down as well. When I fidgeted around with my code I must have fudged something up. Because now when I run the same code, I get this black bar that won't go away.

Unscrolled (normal)

enter image description here

Scrolled Up (leaves ugly black bar)

enter image description here

What I've also tried

GTScrollNavigationBar and TLYShyNavBar

and they both leave the black bar also...

Question

Does anyone know how to fix this?

Community
  • 1
  • 1
Brandon A
  • 7,281
  • 3
  • 34
  • 70
  • 1
    Check the size of your view. It might not extend behind the nav bar so when you hide the nav bar there's nothing behind it so it's black. – AdamPro13 Aug 14 '14 at 01:13
  • Yes, extend your view height. Increase AppDelegate.window height and set origin.y for that to make sure it starts from top. – Kampai Aug 14 '14 at 04:50

2 Answers2

21

I think your issue here has to do with your navigation bar not being transparent. In your view controller, make sure the property Under Opaque Bars is checked and it should be fine.

enter image description here

Another way to doing that is to set extendedLayoutIncludesOpaqueBars to YES (not the default) on your view controller.

Thomas
  • 1,874
  • 14
  • 20
  • I am using AVCapture session to scan the qr code after this . qr code detecter bounds using `objectCaptureVideoPreviewLayer?.transformedMetadataObject` is not at correct place. qrcode image is beneath box starting – Prashant Tukadiya Feb 27 '18 at 12:54
1

I would recommend to just do it in code for full control and additional possibilities later on.

Simply set the background color of the concerned tableview. In your case that would be something like this:

self.navigationController.view.backgroundColor = [UIColor whiteColor];
deijmaster
  • 553
  • 5
  • 10