在AppDelegate中
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool 方法内
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window!.backgroundColor = UIColor.whiteColor()
let vc1 = HomeViewController()
let url1 = NSBundle.mainBundle().URLForResource("home", withExtension: "png")
let nsData1 = NSData(contentsOfURL: url1!)
let image1 = UIImage(data: nsData1!, scale: 5)//设置缩小五倍 可以用其他方式创建UIImage
vc1.tabBarItem = UITabBarItem(title: "首页", image: image1, tag: 1)
let vc2 = MakeMoneyViewController()
let url2 = NSBundle.mainBundle().URLForResource("img2", withExtension: "png")
let nsData2 = NSData(contentsOfURL: url2!)
let image2 = UIImage(data: nsData2!, scale: 5)
vc2.tabBarItem = UITabBarItem(title: "页面2", image: image2, tag: 2)
let arr = [vc1, vc2]
let tabBarController = UITabBarController()
tabBarController.viewControllers = arr
self.window!.rootViewController = tabBarController
self.window!.makeKeyAndVisible()
self.window!.backgroundColor = UIColor.whiteColor()
let vc1 = HomeViewController()
let url1 = NSBundle.mainBundle().URLForResource("home", withExtension: "png")
let nsData1 = NSData(contentsOfURL: url1!)
let image1 = UIImage(data: nsData1!, scale: 5)//设置缩小五倍 可以用其他方式创建UIImage
vc1.tabBarItem = UITabBarItem(title: "首页", image: image1, tag: 1)
let vc2 = MakeMoneyViewController()
let url2 = NSBundle.mainBundle().URLForResource("img2", withExtension: "png")
let nsData2 = NSData(contentsOfURL: url2!)
let image2 = UIImage(data: nsData2!, scale: 5)
vc2.tabBarItem = UITabBarItem(title: "页面2", image: image2, tag: 2)
let arr = [vc1, vc2]
let tabBarController = UITabBarController()
tabBarController.viewControllers = arr
self.window!.rootViewController = tabBarController
self.window!.makeKeyAndVisible()