Внешний вид в Xcode 4.2 не работает

Я добавил этот код в свой AppDelegate в методе didFinishLaunchingWithOptions:

[[UINavigationBar appearance]setBackgroundColor:[UIColor colorWithRed:221/256.0 green:36/256.0 blue:40/256.0 alpha:0.0]];

[[UITabBar appearance] setBackgroundColor:[UIColor colorWithRed:221/256.0 green:36/256.0 blue:40/256.0 alpha:0.0]];

Но NavigationBar и TabBar не изменили свой цвет. Что я сделал не так? Спасибо


person SmartTree    schedule 10.01.2012    source источник


Ответы (1)


Используйте setTintColor: вместо setBackgroundColor:

[[UINavigationBar appearance] setTintColor:[UIColor colorWithRed:221/256.0 green:36/256.0 blue:40/256.0 alpha:0.0]];
[[UITabBar appearance] setTintColor:[UIColor colorWithRed:221/256.0 green:36/256.0 blue:40/256.0 alpha:0.0]];
person jonkroll    schedule 10.01.2012
comment
Ох... верно, сумасшедшая ошибка. Спасибо! Но в этом случае только NavigationBar меняет свой цвет, а TabBar остается черным. Вы не знаете, почему так происходит? - person SmartTree; 11.01.2012
comment
Не уверен, но вы можете попробовать эту технику. . - person jonkroll; 11.01.2012
comment
О, я понял, почему это не работает. Мой alpha цвет был 0.0 :D - person SmartTree; 11.01.2012