UITabBarController使用须知

UITabBarController在我们的开发中经常被用到。关于它的使用,有几个须要注意的地方:
1、UITabBarController会抗拒和别的视图控制器组合,所以最好只将UITabBarController做为整个App的根视图。

 When deploying a tab bar interface, you must install this view as the root of your window. Unlike other view controllers, a tab bar interface should never be installed as a child of another view controller.  [Apple]
苹果的官方文档里要求我们将UITabBarController实例做为整个应用的“根”,这是最为被苹果接受的用法。
参考:http://blog.zhaojie.me/2010/12/iphone-composition-resistant-uitabbarcontroller.html

        http://stackoverflow.com/questions/8929462/uinavigationcontroller-pushing-uitabbarcontroller-only-displays-one-tab

2、最好不要去子类化UITabBarController。
This class is not intended for subclassing. Instead, you use instances of it as-is to present an interface that allows the user to choose between different modes of operation. [Apple]
苹果建议我们最好不要去子类化它,这个类主要被设计用来管理多个view controller并且展示多个view。

3、UITabBarController的viewControllers数组中不要出现相同的指针,标签栏控制器不会为相同的指针创建有效的标签。
Because selecting a tab replaces the contents of the interface, the type of interface managed in each tab need not be similar in any way. [Apple]







  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值