iOS 使用代码和storyboard分别创建UITabBarController
来源:互联网 发布:ubuntu 17.04 cuda8.0 编辑:程序博客网 时间:2024/06/01 09:27
转自 http://blog.csdn.net/ssrrxx111/article/details/48315843
1、iOS中最常见的一种布局,在底部设置Tab导航,分别控制不同的视图。
2、使用代码的方式创建UITabBarController。
1)在AppDelegate的
方法中,新建UITabBarController,然后新建自己需要的UIViewController或者UITableViewController。将这些视图作为UINavigationController的根视图。使用方法initWithRootViewController。
2)设置UITabBarController的viewControllers属性,这里是一个数组,可以把之前的UINavigationController设置在数组中。
3)获取UITabBarController的tabBar属性。然后创建多个UITabBarItem与上面的视图对应起来。设置UITabBarItem的title和image,分别对应标题和图像。
在tabbarcontroller中最多只能放4个tab,如果超过了4个,那么后面的都会自动生成一个More的tab,然后将多余的tab项放在More对应的TableViewController视图中。
使用代码创建UITabBarController的代码如下:
3、使用storyboard创建UITabBarController的方式比较简单。
1)在sb中,选择对象视图,选择Tab Bar Controller,拖到sb中。
此时在sb中你可以看到一个TabBarController对应两个UIViewController
2)新建ViewController或者TableViewController。选中TabBarController视图最顶上的第一个小圆点,使用control键连接新建的视图,用这种方式新建segue,选择Relationship Segue下的view controllers。
使用上面的方式就可以创建成功了。然后还可以在sb中直接定义每一个tabbaritem的title和imge。
0 0
- iOS 使用代码和storyboard分别创建UITabBarController
- 使用代码和storyboard分别创建UITabBarController
- 用 storyboard 创建 UITabBarController
- [IOS]代码创建UINavigationController+UITabBarController
- iOS开发 代码创建UITabBarController
- ios开发----使用代码创建UI界面-----使用Main.storyboard
- iOS开发之UITabBarController的创建和使用
- StoryBoard初探(二):使用UINavigationController和UITabBarController
- [讨论]iOS 开发之使用XIB/StoryBoard 和 使用代码
- iOS开发技巧-使用storyboard和代码设置RGB颜色
- ios-day13-02(UITabBarController使用代码的方式创建并添加子控制器)
- [IOS开发] 高度自定义 UITabBarController, 支持StoryBoard
- iOS Storyboard UI框架搭建,UITabBarController UINavigationController
- 用代码创建UITabBarController
- 用代码创建UITabBarController
- 代码创建 UITabBarController
- iOS Swift创建UITabBarController
- UIKit 06、使用UITabBarController 和 自定义标签栏控件 创建多视图的iOS应用程序
- mysql数据库修改root密码方法
- 字符串操作总结
- Perl脚本按CTRL+C无法退出的解决办法
- 头文件中写类的实现出现函数重复定义的问题
- 求数组中两个元素的最小距离
- iOS 使用代码和storyboard分别创建UITabBarController
- mysql批量插入更新加参数rewriteBatchedStatements
- AngularJS初识--指令相关知识总结
- 自定义View
- oc文件路径
- ehcache缓存实战
- mysql锁表,MVCC以及基础知识、锁、隔离级别、协议
- golang json数组拼接
- Spark 和hadoop的一些面试题2(准备)