lib/ProMotion/screen/nav_bar_module.rb in ProMotion-2.6.1 vs lib/ProMotion/screen/nav_bar_module.rb in ProMotion-2.7.0
- old
+ new
@@ -33,16 +33,10 @@
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={})
- mp "set_nav_bar_right_button and set_nav_bar_left_button have been removed. Use set_nav_bar_button :right/:left instead.", force_color: :yellow
- end
- alias_method :set_nav_bar_right_button, :set_nav_bar_left_button
-
def set_toolbar_items(buttons = [], animated = true)
if buttons
self.toolbarItems = Array(buttons).map{|b| b.is_a?(UIBarButtonItem) ? b : create_toolbar_button(b) }
navigationController.setToolbarHidden(false, animated:animated)
else
@@ -79,11 +73,14 @@
end
def bar_button_item(button_type, args)
return mp("`system_icon:` no longer supported. Use `system_item:` instead.", force_color: :yellow) if args[:system_icon]
return button_type if button_type.is_a?(UIBarButtonItem)
- return bar_button_item_system_item(args) if args[:system_item]
+ if args[:system_item]
+ mp("Nav bar button specified both `system_item:` and `title:`. Title will be ignored.", force_color: :yellow) if args[:title]
+ return bar_button_item_system_item(args)
+ end
return bar_button_item_image(button_type, args) if button_type.is_a?(UIImage)
return bar_button_item_string(button_type, args) if button_type.is_a?(String)
return bar_button_item_custom(button_type) if button_type.is_a?(UIView)
mp("Please supply a title string, a UIImage or :system.", force_color: :red) && nil
end
@@ -109,10 +106,11 @@
def bar_button_item_custom(custom_view)
UIBarButtonItem.alloc.initWithCustomView(custom_view)
end
def map_bar_button_system_item(symbol)
+ mp("Nav bar button stytem item `:page_curl` has been deprecated.", force_color: :yellow) if symbol == :page_curl
{
done: UIBarButtonSystemItemDone,
cancel: UIBarButtonSystemItemCancel,
edit: UIBarButtonSystemItemEdit,
save: UIBarButtonSystemItemSave,
@@ -133,17 +131,18 @@
pause: UIBarButtonSystemItemPause,
rewind: UIBarButtonSystemItemRewind,
fast_forward: UIBarButtonSystemItemFastForward,
undo: UIBarButtonSystemItemUndo,
redo: UIBarButtonSystemItemRedo,
- page_curl: UIBarButtonSystemItemPageCurl
+ page_curl: UIBarButtonSystemItemPageCurl # DEPRECATED
}[symbol] || UIBarButtonSystemItemDone
end
def map_bar_button_item_style(symbol)
+ mp("Nav bar button style `:bordered` has been deprecated.", force_color: :yellow) if symbol == :bordered
{
plain: UIBarButtonItemStylePlain,
- bordered: UIBarButtonItemStyleBordered,
+ bordered: UIBarButtonItemStyleBordered, # DEPRECATED
done: UIBarButtonItemStyleDone
}[symbol] || UIBarButtonItemStyleDone
end
end