Method: ProMotion::NavBarModule#add_nav_bar

Defined in:
lib/ProMotion/screen/nav_bar_module.rb

#add_nav_bar(args = {}) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
# File 'lib/ProMotion/screen/nav_bar_module.rb', line 49

def add_nav_bar(args = {})
  args = self.class.get_nav_bar.merge(args)
  return unless args[:nav_bar] || args[:nav_controller]
  self.navigationController ||= begin
    self.first_screen = true if self.respond_to?(:first_screen=)
    nav_controller_class = args[:nav_controller] || NavigationController
    if nav_controller_class.is_a? Class
      nav = nav_controller_class.alloc.initWithRootViewController(self)
    else
      nav = nav_controller_class
      nav.setViewControllers([self], animated: false)
    end
    nav.setModalTransitionStyle(args[:transition_style]) if args[:transition_style]
    nav.setModalPresentationStyle(args[:presentation_style]) if args[:presentation_style]
    nav
  end
  self.navigationController.toolbarHidden = !args[:toolbar] unless args[:toolbar].nil?
end