swift-导航栏和tabbar(系统自带)
2015-06-17 13:47
591 查看
1,在AppDelegate.swift里面(下面这个函数里面写)
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
//定义三个视图
var oneview = Oneview()
var twoview = Twoview()
var threeview = ThreeView()
//导航栏
var threenav : UINavigationController = UINavigationController(rootViewController: threeview)
var oneNav :UINavigationController = UINavigationController(rootViewController: oneview)
var twoNav :UINavigationController = UINavigationController(rootViewController: twoview)
//tabbar
var oneItem :UITabBarItem = UITabBarItem(tabBarSystemItem: UITabBarSystemItem.Bookmarks, tag: 0)
var twoItem :UITabBarItem = UITabBarItem(tabBarSystemItem: UITabBarSystemItem.Downloads, tag: 1)
var treeItem :UITabBarItem = UITabBarItem(tabBarSystemItem: UITabBarSystemItem.Favorites, tag: 2)
oneview.tabBarItem = oneItem
twoview.tabBarItem = twoItem
threeview.tabBarItem = treeItem
var tc = UITabBarController()
tc.tabBar.barTintColor = UIColor.blackColor()
tc.viewControllers = [oneNav,twoNav,threenav]
self.window?.rootViewController = tc;
return true
}
func application(application: UIApplication, didFinishLaunchingWithOptions launchOptions: [NSObject: AnyObject]?) -> Bool {
//定义三个视图
var oneview = Oneview()
var twoview = Twoview()
var threeview = ThreeView()
//导航栏
var threenav : UINavigationController = UINavigationController(rootViewController: threeview)
var oneNav :UINavigationController = UINavigationController(rootViewController: oneview)
var twoNav :UINavigationController = UINavigationController(rootViewController: twoview)
//tabbar
var oneItem :UITabBarItem = UITabBarItem(tabBarSystemItem: UITabBarSystemItem.Bookmarks, tag: 0)
var twoItem :UITabBarItem = UITabBarItem(tabBarSystemItem: UITabBarSystemItem.Downloads, tag: 1)
var treeItem :UITabBarItem = UITabBarItem(tabBarSystemItem: UITabBarSystemItem.Favorites, tag: 2)
oneview.tabBarItem = oneItem
twoview.tabBarItem = twoItem
threeview.tabBarItem = treeItem
var tc = UITabBarController()
tc.tabBar.barTintColor = UIColor.blackColor()
tc.viewControllers = [oneNav,twoNav,threenav]
self.window?.rootViewController = tc;
return true
}
相关文章推荐
- [翻译]Swift编程语言——高级操作符
- [翻译]Swift编程语言——访问控制
- [翻译]Swift编程语言—— 泛型
- [翻译]Swift编程语言——协议
- [翻译]Swift编程语言—— 扩展
- [翻译]Swift编程语言—— 嵌套的类型
- [翻译]Swift编程语言——造型
- [翻译]Swift编程语言——可选类型链
- 喜欢Swift编程语言的人主要是初学者?
- swift down cast
- swift type identify 类型检查
- 用swift实现navigation bar的完全透明 & navigation bar中button的字体大小调整
- The Swift Programming Language中文完整版(CocoaChina精校)-pdf
- iOS游戏框架Sprite Kit基础教程——Swift版上册第一章-pdf
- iOS游戏框架Sprite Kit基础教程——Swift版上册第二章-pdf
- Digital Booklet - Taylor Swift Karao-pdf
- [翻译]Swift编程语言——自动引用计数
- [翻译]Swift编程语言——析构
- [翻译]Swift编程语言——初始化
- [翻译]Swift编程语言——继承