2012-01-29 29 views
1

我有一個通過代碼創建的導航欄。當我改變它的tintColor酒吧是壞的。 Hoverer的顏色很簡單,而不是iOS風格。我可以改變這個嗎?由於導航欄類型:代碼是?

enter image description here

UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:frontViewController]; 
    navigationController.navigationBar.tintColor = [UIColor colorWithRed:0 green:166 blue:208 alpha:1]; 

回答

5

這是因爲該方法調用的UIColor你正在期待浮動在0.0和1.0之間的值,而你是在直RBG值傳遞的整數:

這將工作:

myNavigationBar.tintColor = [UIColor colorWithRed:((0 * 1.0)/255) green:((166 * 1.0)/255) blue:((208 * 1.0)/255) alpha:1.0]; 
+0

謝謝!工作得很好 – 2012-01-29 11:57:52