CYLTabBarController icon indicating copy to clipboard operation
CYLTabBarController copied to clipboard

[Q-A]iOS13怎么修改tabbar上的文字大小,以前的方法失效了,点进去找半天没找到新的方法

Open PZXforXcode opened this issue 6 years ago • 2 comments

selectedAttrs[NSFontAttributeName] = [UIFont systemFontOfSize:12.f];

以前用的这句代码。兄弟萌知道新的代码吗

PZXforXcode avatar Oct 09 '19 07:10 PZXforXcode

我找到了


        UITabBarAppearance *appearance = UITabBarAppearance.new;
        NSMutableParagraphStyle *par = [[NSMutableParagraphStyle alloc]init];
        par.alignment = NSTextAlignmentCenter;
       
        UITabBarItemStateAppearance *normal = appearance.stackedLayoutAppearance.normal;
   if (normal) {
   normal.titleTextAttributes =    @{NSFontAttributeName : [UIFont systemFontOfSize:font]};
   }
   
   UITabBarItemStateAppearance *selected = appearance.stackedLayoutAppearance.selected;
   if (selected) {
        selected.titleTextAttributes =  @{NSFontAttributeName : [UIFont systemFontOfSize:font]};
   }
   
   tabar13.standardAppearance = appearance;

PZXforXcode avatar Oct 09 '19 08:10 PZXforXcode

遇到相同问题的朋友可以看看

PZXforXcode avatar Oct 09 '19 08:10 PZXforXcode