Sha256: f797d87be314c6ee86a4ed46e8c7e50ae0779696fcfa07e65e35c170ec4b9870

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

module MotionTab
  module TabBar
    def createTabBarControllerFromData(data)
      main_view = MainViewController.alloc.initWithNibName(nil, bundle: nil)
      settings_view = SettingsViewController.alloc.initWithNibName(nil, bundle: nil)
      
      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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
motion-tab-0.0.1 lib/motion-tab/tab_bar.rb