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

Disable gesture recognition for certain screens only #11

Closed cheenu closed 11 years ago

cheenu commented 11 years ago

Thanks for creating this @macfanatic! It has been very useful so far.

I just wanted to know if there is any way to disable the slide menu gesture recognition on certain screens?

I tried putting in

App.delegate.slide_menu.recognizesPanningOnFrontView = false

in the on_load method of a screen but it seems the slide_menu isn't defined as it gives this error

`on_load': undefined method `recognizesPanningOnFrontView=' for nil:NilClass (NoMethodError)

The initiation of the slide menu follows this pattern

class AppDelegate < ProMotion::Delegate
  def on_load(app, options)

    open LoginScreen.new(nav_bar: false)
  end
end
class LoginScreen < ProMotion::Screen
  def will_appear
    @sign_in.when(UIControlEventTouchUpInside) do
      my_tabs = PM::TabBarController.new ScreenOne.new(nav_bar: true), ScreenTwo.new(nav_bar: true)
     end
  end
end

and then in ScreenOne or ScreenTwo's on_load method, I try the App.delegate.slide_menu but slide_menu is not defined.

Hope it made sense!

cheenu commented 11 years ago

Fixed this, the slide_menu reference is accessible in the def on_appear method

macfanatic commented 11 years ago

Awesome, thanks for sharing the fix.