-
Notifications
You must be signed in to change notification settings - Fork 1
/
tab_bar.rb
31 lines (24 loc) · 896 Bytes
/
tab_bar.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
module MotionTab
module TabBar
def createTabBarControllerFromData(data)
mt_tab_controllers = []
data.each do |tab|
tab[:badgeNumber] = 0 unless tab[:badgeNumber]
viewController = tab[:viewController].alloc.init
viewController.tabBarItem = tabBarIcon(tab[:systemIcon], tab[:badgeNumber]) if tab[:systemIcon]
if tab[:navigationController]
controller = UINavigationController.alloc.initWithRootViewController(viewController)
else
controller = viewController
end
mt_tab_controllers << controller
end
tabBarController = UITabBarController.alloc.init
tabBarController.viewControllers = mt_tab_controllers
return tabBarController
end
def tabBarItem(icon, tag = 0)
return UITabBarItem.alloc.initWithTabBarSystemItem(icon, tag: tag)
end
end
end