jamonholmgren / ProMotion

ProMotion is a RubyMotion gem that makes iPhone development less like Objective-C and more like Ruby.
MIT License
1.26k stars 147 forks source link

Can't push view more than 2 levels #113

Closed genewoo closed 11 years ago

genewoo commented 11 years ago

I create 3 level navigation views.

Home -> Add -> Selection View.

I could open Home and Add Screen without problem. But I can't see the Selection View at all. I tried alternative code from Add to Selection View, the view was shown without problem. So something happen with 2nd push_view_controller.

Any one tried push view more than 2 levels?

genewoo commented 11 years ago

I am using both open and push_view_controller. neither works for me. I found some work around by using SugarCube's self.navigationController << @select_screen.

I think this might be an issue with ProMotion

jamonholmgren commented 11 years ago

Hi @genewoo, thanks for reporting this. I built a little app to test this and it worked fine.

screen shot 2013-06-03 at 8 07 53 am screen shot 2013-06-03 at 8 07 58 am screen shot 2013-06-03 at 8 08 00 am

Can you post some of your code?

jamonholmgren commented 11 years ago

https://github.com/jamonholmgren/promotion_issue_113

genewoo commented 11 years ago

Oh, I found the issue, the issue is :

Only the app delegator could declare (nav_bar: true). for the other screen, should not add that.

A suggestion for PM code:

  # Wrap in a PM::NavigationController?
  screen.add_nav_bar if args[:nav_bar] && screen.respond_to?(:add_nav_bar)

should we detected current nag_bar is available before add it?

jamonholmgren commented 11 years ago

Got it. One problem is that you can create a nav_bar before actually opening the screen. Example:

@my_screen = MyScreen.new(nav_bar: true)

# never actually open it

Maybe we need to set an instance var to true and not actually instantiate the nav_bar until it's pushed onto a view.