2010-01-08 39 views

回答

2

都能跟得上。但是,您可以將提示設置爲空字符串,並在其上放置一個紅色標籤。

4

這是一個老問題,但由於引入appearance存在要設置比添加一個子視圖提示顏色(和其它性能)更簡單的方法。

didFinishLaunchingWithOptions

[[UINavigationBar appearance] setTitleTextAttributes:[NSDictionary dictionaryWithObjectsAndKeys:[UIColor theColorYouWantYourPromptToBe], UITextAttributeTextColor, otherVariables, nil]]; 
+3

感謝,偉大的iOS5的。您可能也需要定製的影子,所以這裏的代碼全部行:'[[UINavigationBar的外觀] setTitleTextAttributes:[NSDictionary的dictionaryWithObjectsAndKeys:[的UIColor whiteColor],UITextAttributeTextColor,[的UIColor colorWithRed:0綠:0藍色:0阿爾法: 0.3f],UITextAttributeTextShadowColor,[NSValue valueWithUIOffset:UIOffsetMake(0,-1)],UITextAttributeTextShadowOffset,零]];' – Martin 2012-07-24 17:26:41

+2

這確實改變提示的顏色,但它也改變了標題的顏色。有沒有辦法改變提示顏色? – sensslen 2013-01-05 22:16:25

+0

如果只有提示文本顏色的內部變量,我還沒有找到它。此時,使用自定義子類會更快(也更安全)。 – Andrew 2013-02-06 13:20:05