Changing font size of tabbaritem

后端 未结 10 1818
忘掉有多难
忘掉有多难 2020-11-30 06:18

Is it possible to change the font size of tabs?

10条回答
  •  臣服心动
    2020-11-30 06:53

    TabBarIncreaseFonts(self.tabBarController);
    
    
    void TabBarIncreaseFonts(UITabBarController* customTabBarController)
    {
    
        for(UIView* controlLevelFirst in [customTabBarController.tabBar subviews])
        {
    
            if(![controlLevelFirst isKindOfClass:NSClassFromString(@"UITabBarButton")])
                continue;
    
            for(id controlLevelSecond in [controlLevelFirst subviews])
            {
                [controlLevelSecond setBounds: CGRectMake(0, 0, 100, 48)];
    
                if(![controlLevelSecond isKindOfClass:NSClassFromString(@"UITabBarButtonLabel")])
                     continue;
    
                 [controlLevelSecond setFont: [UIFont boldSystemFontOfSize:20]]; 
                 [controlLevelSecond setFrame: CGRectMake(0, 0, 96, 48)];
                 [controlLevelSecond setTextAlignment:UITextAlignmentCenter];
            }
        }
    }
    

提交回复
热议问题