lib/ProMotion/containers/tabs.rb in ProMotion-1.1.2 vs lib/ProMotion/containers/tabs.rb in ProMotion-1.2.0

- old
+ new

@@ -1,11 +1,13 @@ +motion_require '../extensions/conversions' + module ProMotion module Tabs include Conversions - + attr_accessor :tab_bar, :tab_bar_item - + def open_tab_bar(*screens) self.tab_bar = PM::TabBarController.new(screens) delegate = self.respond_to?(:open_root_screen) ? self : UIApplication.sharedApplication.delegate @@ -41,11 +43,11 @@ elsif icon_image.is_a?(Hash) icon_selected = icon_image[:selected] icon_unselected = icon_image[:unselected] icon_image = nil end - + item = UITabBarItem.alloc.initWithTitle(title, image:icon_image, tag:tag) if icon_selected || icon_unselected item.setFinishedSelectedImage(icon_selected, withFinishedUnselectedImage: icon_unselected) end @@ -64,17 +66,17 @@ tab_bar_item.badgeValue = tab[:badge_number].to_s unless tab[:badge_number].nil? || tab[:badge_number] <= 0 return tab_bar_item end - + def replace_current_item(tab_bar_controller, view_controller: vc) controllers = NSMutableArray.arrayWithArray(tab_bar_controller.viewControllers) controllers.replaceObjectAtIndex(tab_bar_controller.selectedIndex, withObject: vc) tab_bar_controller.viewControllers = controllers end - + def map_tab_symbol(symbol) @_tab_symbols ||= { more: UITabBarSystemItemMore, favorites: UITabBarSystemItemFavorites, featured: UITabBarSystemItemFeatured, @@ -88,21 +90,21 @@ most_recent: UITabBarSystemItemMostRecent, most_viewed: UITabBarSystemItemMostViewed } @_tab_symbols[symbol] || symbol end - + module TabClassMethods def tab_bar_item(args={}) @tab_bar_item = args end def get_tab_bar_item @tab_bar_item end end - + def self.included(base) base.extend(TabClassMethods) end - + end end