infinitered / ProMotion-menu

RubyMotion gem allowing you to easily setup a facebook or Path style hidden slide menu easily with the ProMotion gem.
74 stars 29 forks source link

Menu appearing under title bar in iOS7 #8

Closed jbroadway closed 9 years ago

jbroadway commented 11 years ago

When the slide menu appears, the top appears beneath the title bar in iOS7, whether it's the title or the first item in the list. Here's a screenshot and a demo app to show the issue:

https://raw.github.com/jbroadway/promotion-slide-menu-titlebar-bug/master/pro_motion_slide_menu_bug.png https://github.com/jbroadway/promotion-slide-menu-titlebar-bug

macfanatic commented 11 years ago

@jbroadway - what would you propose the solution be. In iOS 7 the status bar no longer "takes" up that top part of the screen to push your content down, to my understand. Potentially just resizing the table view to move it down the 44px (whatever the height) is a solution?

jbroadway commented 11 years ago

I would think adding a condition to check the OS version and automatically adjusting accordingly would be the most intuitive behaviour, similar to this:

http://roadfiresoftware.com/2013/09/developing-for-ios-7-and-supporting-ios-6/

I'm fine with adding it manually if need be, although I'm not sure what to add for that just yet. If it should stay a manual choice, documenting how to adjust that would probably be useful for others too.

jamonholmgren commented 11 years ago

We plan to add this automatically in ProMotion.

josch1710 commented 11 years ago

@jamonholmgren How long will that take?

jamonholmgren commented 11 years ago

Wish I could work on it now, but I'm under the gun for a website launch Tuesday, so that's what I'm working on. Maybe if I get time tomorrow I'll hack on it.

josch1710 commented 11 years ago

Fair enough. Take your time.

jamonholmgren commented 11 years ago

I believe that you can use:

self.edgesForExtendedLayout = UIRectEdgeNone

... in the TableScreen and it should work like iOS 6. I haven't tested it though.

josch1710 commented 11 years ago

Hmm. I tried that, but it didn't work.

jbroadway commented 11 years ago

I didn't actually notice before but the nav screen also doesn't extend all the way to the bottom, leaving an empty black space about the same height as the title bar.

adtaylor commented 11 years ago

I've come across the same problem and have come to the conclusion it is an issue within PKRevealController.

If you log the frame of the Navigation Screen at on_init you will see that the initial frame origin Y is set at 20, but by will_appear it is set at 0. This causes the content to be set under the status bar and appear to be too short.

PKRevealController seems to be setting the origin Y to 0. When I added the line frame.origin.y = 20; to the below method I got the results I expected. Obviously this isn't a solution.

https://github.com/pkluz/PKRevealController/blob/master/PKRevealController/Controller/PKRevealController.m#L1345

I'm not really sure of the best way to get around this, I can't seem to programatically reset the frame on will_appear either. Any ideas?

macfanatic commented 11 years ago

I tried overwriting ProMotionSlideMenu::SlideMenuScreen#leftViewFrame to return a CGRect with a y value appropriate, but I just get the app crashing without a usable log.

adtaylor commented 11 years ago

I've also tried to overwrite and had the same problems. In the end I have had to create a fork of PKRevealController that changes Y to 20 on iOS7+

pod 'PKRevealController', :git => 'git@github.com:thebeansgroup/PKRevealController.git'

I'm not sure if the user case for this fix is a little too specific to add a pull request to the PKRevealController pod. Any thoughts?

macfanatic commented 11 years ago

I'm not even sure submitting a PR to the project would get merged in, there has been no commits for 9 months on it

cheenu commented 11 years ago

@adtaylor Thanks for figuring out a solution!

However, this leaves a 20px black band at the top which hides the iOS7 status bar text which looks weird. I have been trying to style it so that its background is white, but with no luck. Any ideas?

adtaylor commented 11 years ago

@cheenu Again, its a hacky solution but this should work:

class AppDelegate < ProMotion::AppDelegateParent

  def on_load(app, options)
    open_slide_menu NavigationScreen, MyGreatAppScreen.new(nav_bar: true)
    self.slide_menu.view.backgroundColor = [255,255,255].uicolor
  end

end
cheenu commented 11 years ago

@adtaylor Thanks for the code. Better a hacky solution than no solution. :+1: