//创建window

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


//设置根VC

self.window!.rootViewController = ViewController()


//创建一个btn

var btn = UIButton (frame:CGRect(x:100, y:100, width:100, height:100))


// 设置背景颜色

btn.backgroundColor = UIColor.yellowColor();

// 将添加到我们的vc上

self.window!.rootViewController!.view.addSubview(btn)

self.window!.makeKeyAndVisible()



//创建window

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

//创建VC

let vc =ViewController()

letoneVc =OnrViewController()

lettwo =TwoViewController()

letthree =ThreeViewController()

letfour =FourViewController()

//设置背景颜色

vc.view.backgroundColor=UIColor.redColor()

vc.title="SwiftDemo"

vc.tabBarItem.title= vc.title

oneVc.title="2"

oneVc.view.backgroundColor=UIColor.greenColor()

oneVc.tabBarItem.title= oneVc.title

two.title="3"

two.view.backgroundColor=UIColor.blueColor()

two.tabBarItem.title= two.title

three.title="4"

three.view.backgroundColor=UIColor.brownColor()

three.tabBarItem.title= three.title

four.title="123"

four.view.backgroundColor=UIColor.purpleColor()

four.tabBarItem.title= four.title

//创建nav

letnav1 =UINavigationController(rootViewController:vc)

letnav2 =UINavigationController(rootViewController:oneVc)

letnav3 =UINavigationController(rootViewController:two)

letnav4 =UINavigationController(rootViewController:three)

letnav5 =UINavigationController(rootViewController:four)

lettabber =UITabBarController()

tabber.tabBar.tintColor=UIColor.whiteColor()

tabber.viewControllers= [nav1,nav2,nav3,nav4,nav5]

//设置window的根vc

self.window!.rootViewController= tabber

self.window!.makeKeyAndVisible()