close

setTitleTextAttributes  not working in IOS 13 later:

 

改到 IOS 13 後突然發生 

UINavigationController  和   UITabBarController  組合起來原本正常的導覽列文字顏色不正確

找了半天才發現

 

 if (@available(iOS 13.0, *)) {

        UITabBarAppearance *standardAppearance = [[UITabBarAppearance alloc] init];

        UITabBarItemAppearance *inlineLayoutAppearance = [[UITabBarItemAppearance alloc] init];

        [ inlineLayoutAppearance.normal setTitleTextAttributes:@{  NSForegroundColorAttributeName:[ColorHandler getColorWithR:TXT_MENU_R g:TXT_MENU_G b:TXT_MENU_B a:SOLID_A]}];

        [ inlineLayoutAppearance.selected setTitleTextAttributes:@{ NSForegroundColorAttributeName:[UIColor whiteColor]}];

        standardAppearance.stackedLayoutAppearance = inlineLayoutAppearance;

        standardAppearance.backgroundColor = [ColorHandler getColorWithR:TEXT_TITLE02_R g:TEXT_TITLE02_G b:TEXT_TITLE02_B a:SOLID_A];

        tabBarController.tabBar.standardAppearance = standardAppearance;

        //TXT_MENU_R

    } else {

        // Fallback on earlier versions

    }

arrow
arrow
    全站熱搜
    創作者介紹
    創作者 阿貴貴 的頭像
    阿貴貴

    阿貴貴的亂七八糟雜談

    阿貴貴 發表在 痞客邦 留言(0) 人氣()