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

Disabling panning on the front view #2

Closed bratsche closed 11 years ago

bratsche commented 11 years ago

I can't seem to get this to work. The README says to do this:

App.delegate.slide_menu.recognizesPanningOnFrontView = false

I'm not sure where I should be doing this. It seems like wherever I put this in my code I get the following error:

Objective-C stub for message `setRecognizesPanningOnFrontView:' type `v@:c' not precompiled. Make sure you properly link with the framework or library that defines this message.

... and then the simulator quits.

I've found that if I don't put it anywhere in my code, and then when I get to the repl prompt I can put it there, followed by resetting the slide menu's screen and then it will work as I'm expecting it to.

Is this a bug, or am I doing something obviously wrong?

tmilewski commented 11 years ago

I'm experiencing the same issues.

bratsche commented 11 years ago

I did manage to get my app working the way I wanted, just not the way the docs described. Maybe this will help someone else.

in app_delegate.rb:

class AppDelegate < PM::Delegate
  attr_accessor :slide_menu

  def on_load(app, options)
    open LoginScreen.new
  end

  # Copied this out of promotion_slide_menu's AppDelegate
  def open_slide_menu(menu, content, options = {})
    self.slide_menu = ProMotionSlideMenu::SlideMenuScreen.new(menu, content, options)
    load_root_screen slide_menu
    slide_menu
  end
end

Then I have a LoginScreen, which in my case is a ProMotion::Formotion::FormotionScreen. When the user submits their login info and it authenticates, it does this:

App.delegate.open_slide_menu NavigationScreen, HomeScreen.new

I'm pretty new to RubyMotion, so if I'm doing something obviously stupid let me know. But it appears to accomplish what I want: a LoginScreen where you can't swipe into the navmenu, and once a user logs in successfully then it takes me to HomeScreen where the user can swipe into the navmenu.

macfanatic commented 11 years ago

@bratsche - I am able to reproduce this error as well, have filed a support ticket with RM to help in debugging. Probably related to bridge support files, possibly a problem in PKRevealController cocoa-pod itself.

Thanks for reporting!

macfanatic commented 11 years ago

@bratsche - You should be able to achieve your example even more simply (see below). There should be no need to redefine the attr_accessor line, nor the method definition.

# app/delegate.rb
class AppDelegate < PM::Delegate
  def on_load(app, options)
    open LoginScreen
  end
end

# app/screens/login_screen.rb
class LoginScreen < PM::Screen
  def submit
    App.delegate.open_slide_menu NavigationScreen, HomeScreen
  end
end
tmilewski commented 11 years ago

@bratsche Thank you. Your solution worked out quite well for me.

@macfanatic I can confirm that you do in-fact need to redefine both the attr_accessor and the method definition.