ios swift UITabBarController
来源:互联网 发布:js 点击添加class 编辑:程序博客网 时间:2024/06/10 16:43
在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()
0 0
- ios swift UITabBarController
- iOS - Swift 自定义UITabBarController
- iOS Swift创建UITabBarController
- iOS 自定义UITabbarController中的item (swift)
- ios UITabBarController
- IOS-UITabBarController
- iOS UITabBarController
- iOS UITabBarController
- iOS UITabBarController
- IOS-UITabBarController
- Swift 中UITabBarController使用方法
- Swift之UITabBarController
- Swift UITabBarController 基本用法
- Swift ☞ 自定义UITabBarController
- Swift 设置UITabBarController
- Swift UITabBarController 标签栏控制器
- swift UITabBarController标签栏控制器
- Swift实现自定义的UITabBarController
- UML学习笔记之类图
- 人人都是数据分析师:Tableau应用实战
- 实现一个div的链接在另一个div中显示(框架)
- XMPP客户端库资料
- IE8以下不支持location.origin
- ios swift UITabBarController
- 关于LINUX权限-bash: ./startup.sh: Permission denied
- [OpenJudge-NOI]最大公约数与最小公倍数
- Android注解式绑定控件BindView
- bootstrap兼容IE8问题
- [OpenJudge-NOI]最接近的分数
- python os进行文件操作
- fragment切换来切换去发送花屏或重叠的问题
- boost linux 安装