Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

UINavigationController in menuViewController overlaps status bar #22

Open
duncsand opened this issue Feb 15, 2014 · 9 comments
Open

UINavigationController in menuViewController overlaps status bar #22

duncsand opened this issue Feb 15, 2014 · 9 comments

Comments

@duncsand
Copy link

I'm using a UINavigationContoller in the menuViewController. This works great, but the navigation controller overlaps the phone's status bar - it needs to be nudged down by 20 pixels.

@auto234875
Copy link

I'm having the opposite problem. Using the navigation controller in the mainViewController.

Occasionally, when I dismiss modal from my menuVC and close the side menu, the status bar will overlap the navigationbar. Seems like the navigationbar frame y coordinate starts at 0 instead of 20.

The only way to fix this is to fire off another modalVC and dismiss it.
I can't seem to get this to happen consistently.

Edit: Here's what I've noticed also. Since the modalVC that fires off from my menuVC is a login screen, somehow when I cancel the modal, it never gives this problem.

However, when I log in successfully and dismiss my modal, occasionally it happens.

It's also not like the y coordinate of the navigationbar is wrong. The navigationbar y coordinate is always 0, but what's causing the problem is the height of the navigationbar has changed from 64 to 44.

@jnjosh
Copy link
Contributor

jnjosh commented Feb 16, 2014

@duncsand Putting a navigation controller in the menu side I can see why this would need to be nudged. The controller makes no assumptions about the contents of the view controller you put in there. I suppose we could add some insets that can be applied to the content areas of either side.

@auto234875 I think I've fixed this in a branch working on rotation fixes. I'll be working on getting this merged so maybe that helps your problem. I'll check back in when it is merged.

@auto234875
Copy link

@jnjosh I'll definitely look at it. Right now, I'm limiting my mainVC to portrait because of the previous issue I reported. This is causing I lot of problem because some of my other VC on the stack has to be in landscape and I can't figure out how to force auto-rotation when they pop back to the rootVC (mainVC).

@jnjosh
Copy link
Contributor

jnjosh commented Feb 16, 2014

@auto234875 You can check out the menu_display_issue branch. It is a work in progress but it involved a lot of updates for rotation and landscape.

@auto234875
Copy link

@jnjosh Thanks, I will look into it.

http://imgur.com/vVaGXQs
Link is a picture of the issue. I can't figure out why it only happens when login is success.
In either case, I always use
[self dismissViewControllerAnimated:YES completion:nil];

I'm finding out that this issue arises whenever modal is getting dismissed from my menuVC.

For example, my settingVC which is modal, if I dismiss it without making any change. Everything goes well.

But if I make a change, like disable pocket (read it later feature) and reenable it, which takes me outside the app to login, now if I dismiss the modalVC, I'll get the problem with the navigation bar.
And this happens consistently.

At this point, if I exit the app with the home button and go into it again, I can actually see the 20px change appearing and my navigationbar grows to the proper height.

@auto234875
Copy link

Well guys, I hacked around my problem. But it's not the preferred solution.

What I did was close the sideMenuVC and fire off the modal segue from my mainVC instead of from the menuVC. The status bar issue is taken care of, after doing this, I can't get replicate it anymore.

@duncsand
Copy link
Author

@jnjosh I got the NavController working by nudging the menuController down 20pts and adding a 20pt filler view above in the updateMenuViewWithTransform method.

It seems a bit of a hack though - the content doesn't scroll under the status bar, as the menuController is now 20pts lower. In iOS7 normally the system detects the presence of a UINavigationController and does all this automatically, making sure the content scrolls under the status bar. I'm not sure why this isn't happening here - presumably something to do with the view hierarchy that's confusing things.

@KeepWalkingBR
Copy link

I have the same problem. It happens with me specifically after this sequence of events:

  1. menu is open
  2. you present a modal vc on top of it
  3. app becomes inactive
  4. app becomes active again
  5. Dismiss modal
  6. Close menu

Then the navigation bar starts overlapping with the status bar. A typical cenario is Facebook login. I worked around this, but it's a little ugly and I'm not proud. Basically I removed the modal view after going to background and then put it back before going foreground. So in AppDelegate:

  • (void)applicationDidEnterBackground:(UIApplication *)application {
    if(_sideMenuViewController.isOpen) {
    _modalVC = _sideMenuViewController.menuViewController.presentedViewController;
    if(_modalVC) {
    [_modalVC dismissViewControllerAnimated:NO completion:nil];
    }
    }
    }

  • (void)applicationWillEnterForeground:(UIApplication *)application {
    if(_modalVC) {
    [_sideMenuViewController.menuViewController presentViewController:_modalVC animated:NO completion:nil];
    _modalVC = nil;
    }
    }

    Thanks for the menu, truly great work.

@olala7846
Copy link

@KeepWalkingBR thanks for your solution!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants