UITabBarController基础篇

本文详细介绍了UITabBarController的重要属性及方法,包括viewControllers、selectedViewController等,并深入探讨了与其交互的代理方法,如shouldSelectViewController、didSelectViewController等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

       属性

       viewControllers:视图控制器字典

       selectedViewController:当前正在显示的VC

       selectedIndex:默认选中VC指数

       moreNavigationController:更多导航栏 (超过五个vc出现)

       customizableViewControllers:更多视图中可编辑的视图

       tabBar:标签栏

       方法

       - (void)setViewControllers:(NSArray<__kindof UIViewController *> * __nullable)viewControllers animated:(BOOL)animated;管理视图控制器

       代理方法

        - (BOOL)tabBarController:(UITabBarController *)tabBarController shouldSelectViewController:(UIViewController *)viewController;设置标签栏中的某个选项能否被选中

        - (void)tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController;标签栏的某个标签被选中后执行的操作

        - (void)tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray<__kindof UIViewController *> *)viewControllers ;在标签栏中更多视图控制器中的视图开始编辑执行的方法
        - (void)tabBarController:(UITabBarController *)tabBarController willEndCustomizingViewControllers:(NSArray<__kindof UIViewController *> *)viewControllers changed:(BOOL)changed;在标签栏中更多视图控制器中的视图将要结束编辑执行的方法
        - (void)tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray<__kindof UIViewController *> *)viewControllers changed:(BOOL)changed;在标签栏中更多视图控制器中的视图结束编辑执行的方法

        - (UIInterfaceOrientationMask)tabBarControllerSupportedInterfaceOrientations:(UITabBarController *)tabBarController

        - (UIInterfaceOrientation)tabBarControllerPreferredInterfaceOrientationForPresentation:(UITabBarController *)tabBarController

        - (nullable id <UIViewControllerInteractiveTransitioning>)tabBarController:(UITabBarController *)tabBarController
                      interactionControllerForAnimationController: (id <UIViewControllerAnimatedTransitioning>)animationController

        - (nullable id <UIViewControllerAnimatedTransitioning>)tabBarController:(UITabBarController *)tabBarController
            animationControllerForTransitionFromViewController:(UIViewController *)fromVC
                                              toViewController:(UIViewController *)toVC

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值