Class: PrimeSlidingMenu::SidebarContainerScreen

Inherits:
ECSlidingViewController
  • Object
show all
Includes:
MotionPrime::ScreenBaseMixin
Defined in:
lib/prime_sliding_menu/sidebar_container_screen.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.new(menu, content, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/prime_sliding_menu/sidebar_container_screen.rb', line 5

def self.new(menu, content, options = {})
  screen = self.alloc.initWithTopViewController(nil)
  screen.on_create(options.merge(navigation: false)) if screen.respond_to?(:on_create)
  screen.menu_controller = menu unless menu.nil?
  screen.content_controller = content unless content.nil?
  screen.setAnchorRightRevealAmount 260.0
  screen
end

Instance Method Details

#content_controllerObject



56
57
58
# File 'lib/prime_sliding_menu/sidebar_container_screen.rb', line 56

def content_controller
  self.topViewController
end

#content_controller=(c) ⇒ Object



39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/prime_sliding_menu/sidebar_container_screen.rb', line 39

def content_controller=(c)
  @content_controller_ref = prepare_controller(c)
  if should_reinit_content?(@content_controller_ref)
    self.topViewController = @content_controller_ref
    @content_controller_ref.view.addGestureRecognizer self.panGesture
    @content_controller_ref.view.addGestureRecognizer self.resetTapGesture
    self.resetTapGesture.delegate = self
  else
    content_controller.viewControllers = [@content_controller_ref]
  end
  hide_sidebar
end

#gestureRecognizer(gestureRecognizer, shouldReceiveTouch: touch) ⇒ Object



60
61
62
# File 'lib/prime_sliding_menu/sidebar_container_screen.rb', line 60

def gestureRecognizer(gestureRecognizer, shouldReceiveTouch: touch)
  sidebar_visible?
end

#hide_sidebarObject



18
19
20
# File 'lib/prime_sliding_menu/sidebar_container_screen.rb', line 18

def hide_sidebar
  self.resetTopViewAnimated(false)
end


52
53
54
# File 'lib/prime_sliding_menu/sidebar_container_screen.rb', line 52

def menu_controller
  self.underLeftViewController
end


34
35
36
37
# File 'lib/prime_sliding_menu/sidebar_container_screen.rb', line 34

def menu_controller=(c)
  @menu_controller_ref = prepare_controller(c)
  self.underLeftViewController = @menu_controller_ref
end

#show_sidebarObject



14
15
16
# File 'lib/prime_sliding_menu/sidebar_container_screen.rb', line 14

def show_sidebar
  self.anchorTopViewToRightAnimated(false)
end

Returns:

  • (Boolean)


30
31
32
# File 'lib/prime_sliding_menu/sidebar_container_screen.rb', line 30

def sidebar_visible?
  self.currentTopViewPosition == 1
end

#toggle_sidebarObject



22
23
24
25
26
27
28
# File 'lib/prime_sliding_menu/sidebar_container_screen.rb', line 22

def toggle_sidebar
  if !sidebar_visible?
    show_sidebar
  else
    hide_sidebar
  end
end