3

使用的XCode 5針對iOS6的最低OS創建欄按鈕項目這樣MKUserTrackingBarButtonItem着色顏色IOS7不工作,但確實在IOS 6

self.navigationItem.rightBarButtonItem = [[MKUserTrackingBarButtonItem alloc] initWithMapView:self.mapView]; 

,然後設置其色調像這樣

self.navigationItem.rightBarButtonItem.tintColor = [UIColor colorWithRed:175.0f/255.0f green: 189.0f/255.0f blue: 69.0f/255.0f alpha:1.0f]; 

當我部署到IOS6 devive酒吧按鈕項目被正確着色,但在IOS7設備上,它仍然是藍色的股票

這是別人經歷過的問題嗎? XCode 5的錯誤?

幫助?

感謝

+0

我建議使用不同的(默認值)欄按鈕項目,看問題是否仍然存在。如果是這樣,一些奇怪的事情正在發生。如果沒有,這可能是'MKUserTrackingBarButtonItem'中的一個錯誤。 –

回答

1

從蘋果文檔:

在iOS 6中,tintColor有色的導航欄,標籤欄,工具欄,搜索欄, 和範圍條的背景。要在iOS 7中爲背景添加色調,請改用barTintColor屬性。

iOS 7 Transition Guide

+2

唉。我的問題涉及barbuttonitems而不是導航欄的背景。指南狀態的第23頁使用tintColor爲條形圖項目着色。因爲我的問題表明我正在這樣做 – Piginhat

2

我還沒有找到一個解決這個問題,以及,但我知道改變你的默認窗口顏色將覆蓋它。如果你不介意你的默認窗口顏色被覆蓋,那麼你的應用程序委託的didFinishLaunchingWithOptions方法做了以下操作。

self.window.tintColor = [UIColor colorWithRed:175.0f/255.0f green: 189.0f/255.0f blue: 69.0f/255.0f alpha:1.0f]; 
+0

這也是對我來說很好的解決方案 –

4
MKUserTrackingBarButtonItem *buttonItem = [[MKUserTrackingBarButtonItem alloc] initWithMapView:self.mapView];  
[buttonItem.customView setTintColor:[UIColor colorWithRed:175.0f/255.0f green: 189.0f/255.0f blue: 69.0f/255.0f alpha:1.0f]]; 
+0

這樣做了。謝謝埃迪。 – Verticon