【swift】使用tabbarController出现的问题
来源:互联网 发布:ubuntu 设置密码 编辑:程序博客网 时间:2024/05/18 19:22
当我在自定义的viewController里指定页面时,写下了如下的语句
for i in 0..<names.count{ let ctl = vcs[i] let navi:UINavigationController = UINavigationController.init(rootViewController: ctl) ctl.navigationItem.title = names[i] navi.tabBarItem.title = names[i] arr.add(navi) let img = UIImage.init(named: imgNames[i]) navi.tabBarItem.image = img }
结果在我初始化一个页面的时候出现了神奇的问题,我指定的第一个页面无法正常显示,而且在tabbar中的表现也不正常,经常会出现越界的信息,而且我使用视图来查看view间的关系,结果居然发现
可以看到最外侧中间是空的!
也就是说除了navigationbar和tabbar加上了之外,我其余所有自定义的view都没有添加上,但是我如果单独初始化这个页面时是正常的。这让我困扰了很久。
但是我注意到,每次程序崩溃,都是在点击了左下角那个旅伴之后崩溃的,那么说明一定是这个页面出了问题。但是出了什么问题呢?
通过逐个注释代码,我发现我在页面控制器的文件里声明了一个navigationController的变量,并在viewdidload()
方法里面写了self.nv = UINavigationController.init(rootViewController: self)
这样和在tabbar里面的navigationController冲突了,造成了如此令人崩溃的原因,可算解决了。
阅读全文
0 0
- 【swift】使用tabbarController出现的问题
- Swift开发之 使用系统的TabbarController
- tabBarController 的隐藏问题
- TabBarController的使用
- tabbarController的使用
- TabBarController与NavigationController结合使用时的隐藏问题
- swift 搭建tabbarcontroller
- 使用tabbarcontroller
- swift TabBarController内部控制的viewController视图被tabbar遮挡
- tabbarcontroller+navigationcontroller 导航栏错乱的问题
- ios-Swift中KVC出现的问题
- swift TabBarController UINavigationController 组合使用 带有ScrollView和菜单内容以及tableView
- swift TabBarController UINavigationController 组合使用 带有ScrollView和菜单内容以及tableView
- 使用TabBarController 多视图
- 关于设置navigationController title 和 TabBarController title 的问题
- storyboard设计两级TabBarController,第二级Tabbar的位置问题
- swift中的自动引用计数以及出现的问题
- TabbarController的封装
- solr服务器的搭建 for windows
- springboot输出日志
- 操作系统概念(高等教育出版社,第七版)复习——第三章:进程
- opencv形态学应用之区域填充
- 常用电子元器件及封装 20170612 周一
- 【swift】使用tabbarController出现的问题
- 配置项---tomcat环境变量的配置
- javaSwing_5布局管理器
- 文章标题
- 嵌入式视频方案学习第十一篇——视频编码模块VENC
- JVM对象的创建与内存管理
- springboot集成hibernate-jpa方式
- protothread_简介
- 开发中泛型使用注意事项