UITabbarController

UITabbarController

简介

iOS中的标签控制器,可以对多个控制器进行切换

标签控制器的特性

//委托
@property(nonatomic, assign) id< UITabBarControllerDelegate > delegate
//与这个控制器相关的标签栏
@property(nonatomic, readonly) UITabBar *tabBar

管理控制器

//标签栏里的控制器,数组
@property(nonatomic, copy) NSArray *viewControllers
//给标签控制器设置显示的控制器数组
- (void)setViewControllers:(NSArray *)viewControllers
                  animated:(BOOL)animated
//决定哪些viewController允许重排列
@property(nonatomic, copy) NSArray *customizableViewControllers
//UITabBar上最多可以显示5个Tab,当我们往UITabBarController中添加超过的viewController超过5个时候,最后一个一个就会自动变成more
@property(nonatomic, readonly) UINavigationController *moreNavigationController

管理选中的标签

//当前选中的控制器
@property(nonatomic, assign) UIViewController *selectedViewController
//选中的控制器的顺序的索引
@property(nonatomic) NSUInteger selectedIndex

UITabBarControllerDelegate

注意

管理标签栏的分区

- (BOOL)tabBarController:(UITabBarController *)tabBarController
shouldSelectViewController:(UIViewController *)viewController
- (void)tabBarController:(UITabBarController *)tabBarController
 didSelectViewController:(UIViewController *)viewController

管理自定义标签栏

- (void)tabBarController:(UITabBarController *)tabBarController
willBeginCustomizingViewControllers:(NSArray *)viewControllers
- (void)tabBarController:(UITabBarController *)tabBarController
willEndCustomizingViewControllers:(NSArray *)viewControllers
                 changed:(BOOL)changed
- (void)tabBarController:(UITabBarController *)tabBarController
didEndCustomizingViewControllers:(NSArray *)viewControllers
                 changed:(BOOL)changed

重写视图旋转设置

- (NSUInteger)tabBarControllerSupportedInterfaceOrientations:(UITabBarController *)tabBarController
- (UIInterfaceOrientation)tabBarControllerPreferredInterfaceOrientationForPresentation:(UITabBarController *)tabBarController

自定义标签栏的过渡动画

- (id<UIViewControllerAnimatedTransitioning>)tabBarController:(UITabBarController *)tabBarController
           animationControllerForTransitionFromViewController:(UIViewController *)fromVC
                                             toViewController:(UIViewController *)toVC
- (id<UIViewControllerInteractiveTransitioning>)tabBarController:(UITabBarController *)tabBarController
                     interactionControllerForAnimationController:(id<UIViewControllerAnimatedTransitioning>)animationController
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值