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

[question] how could I add an webview with dedicated URL #56

Closed poc7667 closed 9 years ago

poc7667 commented 9 years ago

I want to do this way for side menu,

    {
    title: 'Home',
    action: :swap_center_controller,
    arguments: WebScreen.new(url: site_url)
    },

But I got this error

<Error>: *** Terminating app due to uncaught exception 'NoMethodError', reason: 'main_controller.rb:35:in `swap_center_controller:': undefined method `new' for #<WebScreen:0x15da43260> (NoMethodError)
poc7667 commented 9 years ago

I found out , I should write the action bymyself.

Thank you :D

class NavigationScreen < ProMotion::TableScreen
  def table_data
    site_url = "https://tw.yahoo.com"
    [{
      title: nil,
      cells: [
        {
        title: 'Home',
        action: :show_webpage,
        arguments: site_url
        },
      ]
    }]
  end

  def show_webpage(site_url)
    app_delegate.menu.center_controller = WebScreen.new(url: site_url, nav_bar: true)
    app_delegate.menu.toggle_left
  end

end