InteractiveSideMenu icon indicating copy to clipboard operation
InteractiveSideMenu copied to clipboard

Status bar vanishes when loading a menu item inside a navigation controller

Open jackdem opened this issue 7 years ago • 22 comments

When I create my menu item controllers, I embed them in navigation controllers.

e.g.

let text = TextViewController(textView: TextView.init(frame: UIScreen.main.bounds), pageID: page.pageid) let navigationController = UINavigationController(rootViewController: text) contentList.append(navigationController)

Issue is when I click one of these items, it loads, but the status bar vanishes and just leaves a black box.

How can i get the behaviour to work as expected and retain the status bar which then takes on the background colour of the navigation bar, as it would do outside of the side menu encapsulation

jackdem avatar Oct 02 '17 10:10 jackdem

Hi @jackdem,

What preferred status bar color do you have, when menu items are loaded? It could be a situation, when you have default (darkContent) and dark background.

If you have another case, please, add screenshots and more details about your case.

Thank you for your question.

okonor avatar Oct 06 '17 07:10 okonor

Hi there, my appearance config looks like this:

UINavigationBar.appearance().tintColor = UIColor.white UINavigationBar.appearance().barTintColor = UIColor().appThemeColour() UINavigationBar.appearance().isTranslucent = false UINavigationBar.appearance().shadowImage = UIImage() UINavigationBar.appearance().titleTextAttributes = [NSForegroundColorAttributeName : UIColor.white] UIApplication.shared.statusBarStyle = .lightContent

I made a stack overflow post on the topic with a bit more detail if it helps:

https://stackoverflow.com/questions/46586451/navigationbar-not-filling-under-status-bar-when-clicked-from-side-menu

jackdem avatar Oct 06 '17 07:10 jackdem

Is it reproduced on iOS 11 only or on all versions?

okonor avatar Oct 06 '17 08:10 okonor

im not sure how to confirm older versions as im only working with 11

jackdem avatar Oct 06 '17 09:10 jackdem

In Xcode you can click on Active Scheme and then Download Simulators and choose version before 11 to download.

Also, this Stack Overflow question should help you.

okonor avatar Oct 09 '17 18:10 okonor

I downloaded iOS 10.0 simulators and it seems to work fine, so its iOS11, is there a fix / solution possible? as currently its not really usable in iOS11 with this behaviour in my use case

jackdem avatar Oct 10 '17 08:10 jackdem

I'll take a look into your issue today. To simplify this work, please, try to reproduce the issue on the sample or send me your code.

okonor avatar Oct 10 '17 08:10 okonor

Also, did you test it on a real device? Or simulator only?

okonor avatar Oct 10 '17 08:10 okonor

Simulator only, i dont have any iOS10 devices.

I cant provide a sample sorry, but the setup is simply, the sidemenu and then clicking an item loads a navigation controller with a viewcontroller assigned to it. This view controller will suffer the black bar issue as the nav bar header doesnt extend up behind the status bar. If you drag the view controller to open the menu then very slowly move it backward closing the menu, you can get the black bar to dissapear for that run of the app. So it seems perhaps its to do with the animation of the open/close vs the navigation bar in iOS11 that causes it

jackdem avatar Oct 10 '17 09:10 jackdem

Hi was there a solution found to this? ive been running my app on iOS10 simulator for a while now but i cant do a public release unless there is a work around, would be much appreciated

jackdem avatar Oct 16 '17 08:10 jackdem

Hi @jackdem ,

It looks like CGAffineTransform(scaleX, y) of ViewController's view works not correctly with NavigationBar in iOS 11. I'm going to report a bug to Apple.

You can use contentScale = 1 for iOS 11 users for now until this issue will not be fixed or we'll find some workaround.

Please, let me know if SideMenu works for your case without content scale.

okonor avatar Oct 16 '17 09:10 okonor

thanks, sorry for the simple question, but where do i set the contentScale?

jackdem avatar Oct 16 '17 09:10 jackdem

Using transitionOptions.contentScale = 1

https://github.com/handsomecode/InteractiveSideMenu#animation-customization

okonor avatar Oct 16 '17 09:10 okonor

unfortunately this didnt fix it, the status bar remains the wrong colour in an iOS11 simulator

jackdem avatar Oct 16 '17 10:10 jackdem

Please, attach the recording. I can't reproduce your issue with contentScale equal to 1.

okonor avatar Oct 16 '17 11:10 okonor

sorry i set it in the viewwilltransition, moved it to the viewdidload and now its fine, no issue. i just loose the nice animation. Is this something that should resolve in the longer term?

jackdem avatar Oct 16 '17 11:10 jackdem

It will depend on Apple's answer

okonor avatar Oct 16 '17 11:10 okonor

I have the same issue, I hope Apple answers soon :)

douglas-srs avatar Dec 26 '17 19:12 douglas-srs

if #available(iOS 11.0, *) { transitionOptions.contentScale = 1 }

Your workaround is working btw!

douglas-srs avatar Dec 26 '17 19:12 douglas-srs

Hi, I have a similar issue but with my project, the navigation bar does not show up at all. Is it possible to get a sample of how to implement this menu with navigation controllers? The side menu works fine but the navigation bar does not show up for any of the view controllers. Also, using a side menu with multiple sections in the table, how do I access other sections to display the right view controllers? I have been at this for weeks!

florencelomojones avatar Jan 03 '18 09:01 florencelomojones

Hey, I just saw it worked with the IPhone SE. So it also have something to do with the size of the screen on IOS 11.

Raegonoth avatar Jan 10 '18 03:01 Raegonoth

The workaround is not proper, if you use the gesture navigation to slowly open and/or slowly close the side menu, the white status bar is displayed and it vanishes when the view takes up the full space.

umarF avatar Aug 24 '18 13:08 umarF