Swift_TabBarController

废话不多说,直接上代码




func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: NSDictionary?) -> Bool {

        self.window = UIWindow(frame: UIScreen.mainScreen().bounds)

        // Override point for customization after application launch.

        self.window!.backgroundColor = UIColor.whiteColor()

        self.window!.makeKeyAndVisible()

        

        // TabBarController

        var navigationController_FirstView = UINavigationController(rootViewController:

UIViewController

())

        navigationController_FirstView.tabBarItem = UITabBarItem(tabBarSystemItem:.Downloads, tag:1)

        

        var navigationController_SecondView = UINavigationController(rootViewController:

UIViewController

())

        navigationController_SecondView.tabBarItem = UITabBarItem(tabBarSystemItem:.Featured, tag:2)

        

        var navigationController_thirdView = UINavigationController(rootViewController:

UIViewController

())

        navigationController_thirdView.tabBarItem = UITabBarItem(tabBarSystemItem:.Featured, tag:3)

        

        

        var aryControllers = [navigationController_FirstView,navigationController_SecondView,navigationController_thirdView]

        

        var tabBarContol:UITabBarController = UITabBarController()

        tabBarContol.setViewControllers(aryControllers, animated: true)

        

        

        self.window!.rootViewController = tabBarContol

        

        

        return true

    }


你可能感兴趣的:(ios,swift)