标签:cte ima roo 标题 with string view round 删除
// 设置整体主题TabBar的tintColor
UITabBar.appearance().tintColor = UIColor.orangeColor()
// 1.创建window
self.window = UIWindow(frame: UIScreen.mainScreen().bounds)
self.window?.backgroundColor = UIColor.whiteColor()
// 2.设置window的根控制器
self.window?.rootViewController = MainViewController()
// 3.让窗口生效
self.window?.makeKeyAndVisible()
override func viewDidLoad() {
super.viewDidLoad()
// 添加自控制器
self.addChildViewController(HomeViewController(), imageName: "tabbar_home", title: "主页")
self.addChildViewController(MessageViewController(), imageName: "tabbar_message_center", title: "消息")
self.addChildViewController(DiscoverViewController(), imageName: "tabbar_discover", title: "广场")
self.addChildViewController(ProfileViewController(), imageName: "tabbar_profile", title: "我")
}
private func addChildViewController(childCVc: UIViewController, imageName : String, title : String) {
// 1.创建自控制器
let homeNav = UINavigationController(rootViewController: childCVc)
// 2.设置标题
childCVc.title = title
childCVc.tabBarItem.selectedImage = UIImage(named: imageName + "_highlighted")
childCVc.tabBarItem.image = UIImage(named: imageName)
// 3.添加到UITabbarController
self.addChildViewController(homeNav)
}
标签:cte ima roo 标题 with string view round 删除
原文地址:http://www.cnblogs.com/xufengyuan/p/7414144.html