Permalink
Browse files

Named parameters on select method.

  • Loading branch information...
1 parent 0e04d06 commit e633fb1ccebe1b0b1a2637fd0bbe3daf464735c3 @jamonholmgren committed Aug 27, 2012
Showing with 9 additions and 3 deletions.
  1. +2 −1 README.md
  2. +6 −1 lib/motion-tab/tab_bar.rb
  3. +1 −1 lib/motion-tab/version.rb
View
@@ -43,7 +43,8 @@ def application(application, didFinishLaunchingWithOptions:launchOptions)
]
tabBarController = MotionTab::TabBar.createTabBarControllerFromData(tabs)
- MotionTab::TabBar.select(tabBarController, "Settings")
+ MotionTab::TabBar.select(tabBarController, title: "Settings")
+ # MotionTab::TabBar.select(tabBarController, tag: 0) # Selects first tab
@window.rootViewController = tabBarController
@window.makeKeyAndVisible
@@ -71,13 +71,18 @@ def tabBarItem(tab)
return tabBarItem
end
- def select(tabBarController, title)
+ def select(tabBarController, title: title)
tabBarController.viewControllers.each do |vc|
if vc.tabBarItem.title == title
tabBarController.selectedIndex = vc.tabBarItem.tag
+ return
end
end
end
+
+ def select(tabBarController, tag: tag)
+ tabBarController.selectedIndex = tag
+ end
end
end
end
@@ -1,3 +1,3 @@
module MotionTab
- VERSION = "0.2.0" unless defined?(MotionTab::VERSION)
+ VERSION = "0.2.1" unless defined?(MotionTab::VERSION)
end

0 comments on commit e633fb1

Please sign in to comment.