class ProMotionSlideMenu::SlideMenuScreen
Public Class Methods
new(content, options={})
click to toggle source
This is added as the root view controller when using the ‘open_slide_menu` method in your application delegate.
Several properties are defined to get the underlying PKRevealController instance for additional configuration, the screen shown as the hidden menu, and the screen shown as the content controller.
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 15 def self.new(content, options={}) screen = self.revealControllerWithFrontViewController(nil, leftViewController: nil, options: nil) screen.content_controller = content unless content.nil? screen.left_controller = options[:left] if options[:left] screen.right_controller = options[:right] if options[:right] screen_options = options.reject { |k,v| [:left, :right].include? k } screen.on_create(screen_options) if screen.respond_to?(:on_create) screen end
Public Instance Methods
content_controller()
click to toggle source
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 68 def content_controller self.frontViewController end
content_controller=(c)
click to toggle source
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 62 def content_controller=(c) controller = prepare_controller_for_pm(c) controller = controller.navigationController || controller self.setFrontViewController controller, focusAfterChange: true, completion: default_completion_block end
controller(side)
click to toggle source
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 80 def controller(side) self.left_controller if side == :left self.right_controller if side == :right self.content_controller if side == :content end
controller=(side={})
click to toggle source
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 72 def controller=(side={}) self.left_controller = side[:left] if side[:left] self.right_controller = side[:right] if side[:right] self.content_controller = side[:content] if side[:content] end
Also aliased as: controllers=
hide(animated = true)
click to toggle source
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 38 def hide(animated = true) self.showViewController content_controller, animated: animated, completion: default_completion_block end
left_controller()
click to toggle source
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 48 def left_controller self.leftViewController end
left_controller=(c)
click to toggle source
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 42 def left_controller=(c) controller = prepare_controller_for_pm(c) controller = controller.navigationController || controller self.setLeftViewController controller, focusAfterChange: true, completion: default_completion_block end
right_controller()
click to toggle source
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 58 def right_controller self.rightViewController end
right_controller=(c)
click to toggle source
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 52 def right_controller=(c) controller = prepare_controller_for_pm(c) controller = controller.navigationController || controller self.setRightViewController controller, focusAfterChange: true, completion: default_completion_block end
show(side, animated=true)
click to toggle source
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 25 def show(side, animated=true) self.show_left(animated) if side == :left self.show_right(animated) if side == :right end
show_left(animated = true)
click to toggle source
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 30 def show_left(animated = true) self.showViewController left_controller, animated: animated, completion: default_completion_block end
show_right(animated = true)
click to toggle source
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 34 def show_right(animated = true) self.showViewController right_controller, animated: animated, completion: default_completion_block end
Protected Instance Methods
default_completion_block()
click to toggle source
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 94 def default_completion_block -> (completed) { true } end
prepare_controller_for_pm(controller)
click to toggle source
# File lib/pro_motion_slide_menu/slide_menu_screen.rb, line 88 def prepare_controller_for_pm(controller) controller = set_up_screen_for_open(controller, {}) ensure_wrapper_controller_in_place(controller, {}) controller end