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

Full example usage #27

Closed devth closed 10 years ago

devth commented 10 years ago

I'm just starting out and don't quite grasp how to use this gem. Is there a full working example? I tried piecing something together from the README but it results in a black screen.

HomeScreen:

class HomeScreen < ProMotion::Screen

  def on_load
    self.view.backgroundColor = UIColor.purpleColor
  end

end

AppDelegate:

class AppDelegate < PM::Delegate

  def on_load(app, options)

    # Open the slide menu with your content view (initially shown) and navigation view(s) (initially hidden)
    open_slide_menu HomeScreen.new(nav_bar: true), left: NavigationScreen

    # You can get to the instance of the slide menu at any time if you need to
    slide_menu.controller(:left).class.name
    # => NavigationScreen

    # SlideMenuScreen is just an enhanced subclass of PKRevealController, so you
    # can do all sorts of things with it
    # slide_menu.disablesFrontViewInteraction = true
    # slide_menu.animationDuration = 0.5

  end

end

and NavigationScreen:

class NavigationScreen < ProMotion::TableScreen

  def table_data
    [{
      title: nil,
      cells: [{
        title: 'Home',
        action: :swap_content_controller,
        arguments: HomeScreen
      }]
    }]
  end

  def swap_content_controller(screen_class)
    App.delegate.slide_menu.controller(content: screen_class)
  end

end

I got the gems and pods installed, and rake, but just get a black screen. Thanks!

macfanatic commented 10 years ago

There are open discussions around this issue in #26 for example.

Recommended fixes for the time being include reverting to an older version of the underlying Cocoapod or switching the cocoa pod out for another one entirely.

Thanks for asking!

devth commented 10 years ago

Thanks, downgrading to pod 'PKRevealController', '2.0.1' fixed things for now!