lib/ProMotion/cocoatouch/tab_bar_controller.rb in ProMotion-1.1.2 vs lib/ProMotion/cocoatouch/tab_bar_controller.rb in ProMotion-1.2.0
- old
+ new
@@ -1,8 +1,8 @@
module ProMotion
class TabBarController < UITabBarController
-
+
def self.new(*screens)
tab_bar_controller = alloc.init
view_controllers = []
@@ -17,27 +17,27 @@
end
tab_bar_controller.viewControllers = view_controllers
tab_bar_controller
end
-
+
def open_tab(tab)
if tab.is_a? String
selected_tab_vc = find_tab(tab)
elsif tab.is_a? Numeric
selected_tab_vc = viewControllers[tab]
end
-
+
if selected_tab_vc
self.selectedViewController = selected_tab_vc if selected_tab_vc
else
PM.logger.error "Unable to open tab #{tab.to_s} -- not found."
nil
end
end
-
+
def find_tab(tab_title)
self.viewControllers.select{ |vc| vc.tabBarItem.title == tab_title }.first
end
-
+
end
end