lib/ProMotion/screen/nav_bar_module.rb in ProMotion-2.2.2 vs lib/ProMotion/screen/nav_bar_module.rb in ProMotion-2.3.0
- old
+ new
@@ -16,17 +16,24 @@
def navigationController=(nav)
@navigationController = nav
end
def set_nav_bar_button(side, args={})
- button = create_toolbar_button(args)
- button.setTintColor args[:tint_color] if args[:tint_color]
+ button = (args.is_a?(UIBarButtonItem)) ? args : create_toolbar_button(args)
+ button.setTintColor args[:tint_color] if args.is_a?(Hash) && args[:tint_color]
self.navigationItem.leftBarButtonItem = button if side == :left
self.navigationItem.rightBarButtonItem = button if side == :right
self.navigationItem.backBarButtonItem = button if side == :back
button
+ end
+
+ def set_nav_bar_buttons(side, buttons=[])
+ buttons = buttons.map{ |b| b.is_a?(UIBarButtonItem) ? b : create_toolbar_button(b) }.reverse
+
+ self.navigationItem.setLeftBarButtonItems(buttons) if side == :left
+ self.navigationItem.setRightBarButtonItems(buttons) if side == :right
end
# TODO: In PM 2.1+, entirely remove this deprecated method.
def set_nav_bar_left_button(title, args={})
PM.logger.deprecated "set_nav_bar_right_button and set_nav_bar_left_button have been removed. Use set_nav_bar_button :right/:left instead."