motion-tab 0.0.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/motion-tab/tab_bar.rb +32 -25
- data/lib/motion-tab/version.rb +1 -1
- metadata +4 -3
data/lib/motion-tab/tab_bar.rb
CHANGED
@@ -1,34 +1,41 @@
|
|
1
1
|
module MotionTab
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
mt_tab_controllers = []
|
2
|
+
class TabBar
|
3
|
+
class << self
|
4
|
+
def createTabBarControllerFromData(data)
|
5
|
+
mt_tab_controllers = []
|
8
6
|
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
7
|
+
data.each do |tab|
|
8
|
+
tab[:badgeNumber] = 0 unless tab[:badgeNumber]
|
9
|
+
tab[:tag] = 0 unless tab[:tag]
|
10
|
+
|
11
|
+
viewController = tab[:viewController].alloc.init
|
12
|
+
viewController.tabBarItem = tabBarIcon(tab[:systemIcon], tab[:tag]) if tab[:systemIcon]
|
13
|
+
viewController.tabBarItem.badgeValue = tab[:badgeNumber].to_s unless tab[:badgeNumber].nil? || tab[:badgeNumber] <= 0
|
14
|
+
|
15
|
+
if tab[:navigationController]
|
16
|
+
controller = UINavigationController.alloc.initWithRootViewController(viewController)
|
17
|
+
else
|
18
|
+
controller = viewController
|
19
|
+
end
|
20
20
|
|
21
|
-
|
22
|
-
|
21
|
+
if tab[:title]
|
22
|
+
controller.tabBarItem.title = tab[:title]
|
23
|
+
else
|
24
|
+
controller.tabBarItem.title = viewController.title
|
25
|
+
end
|
23
26
|
|
24
|
-
|
25
|
-
|
27
|
+
mt_tab_controllers << controller
|
28
|
+
end
|
26
29
|
|
27
|
-
|
28
|
-
|
30
|
+
tabBarController = UITabBarController.alloc.init
|
31
|
+
tabBarController.viewControllers = mt_tab_controllers
|
29
32
|
|
30
|
-
|
31
|
-
|
33
|
+
return tabBarController
|
34
|
+
end
|
35
|
+
|
36
|
+
def tabBarIcon(icon, tag = 0)
|
37
|
+
return UITabBarItem.alloc.initWithTabBarSystemItem(icon, tag: tag)
|
38
|
+
end
|
32
39
|
end
|
33
40
|
end
|
34
41
|
end
|
data/lib/motion-tab/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: motion-tab
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.1.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-08-
|
12
|
+
date: 2012-08-27 00:00:00.000000000 Z
|
13
13
|
dependencies: []
|
14
14
|
description: MotionTab is a RubyMotion gem for making UITabBars easier to implement.
|
15
15
|
email:
|
@@ -47,8 +47,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
47
47
|
version: '0'
|
48
48
|
requirements: []
|
49
49
|
rubyforge_project:
|
50
|
-
rubygems_version: 1.8.
|
50
|
+
rubygems_version: 1.8.22
|
51
51
|
signing_key:
|
52
52
|
specification_version: 3
|
53
53
|
summary: ''
|
54
54
|
test_files: []
|
55
|
+
has_rdoc:
|