2012-04-23 311 views
0

有沒有可能在Cocoa Touch中更改導航欄提示的文本顏色(即帶有可選指令的區域)?文字可以用這個改變如何更改狀態欄提示的文本顏色?

[self.navigationItem setPrompt:@"My Prompt"]; 

但是這個文本的顏色呢?謝謝。

+1

這可能會幫助:http://stackoverflow.com/questions/5827214/iphone-objective-c-change-default-navigationitem-提示顏色 – GravityScore 2012-04-23 12:48:12

+0

是的,這是同樣的問題。我無法找到它。謝謝。 – MoreFamed 2012-05-01 11:16:03

回答

0

你可以一個UILabel添加到您的導航,並設置它的顏色

-(void) viewDidLoad { 
    UILabel *theLabel = [ [UILabel alloc ] initWithFrame:CGRectMake((self.bounds.size.width/2), 0.0, 150.0, 43.0) ]; 
theLabel.textAlignment = UITextAlignmentCenter; 
theLabel.textColor = [UIColor whiteColor]; 
theLabel.backgroundColor = [UIColor blackColor]; 
theLabel.font = [UIFont fontWithName:@"Arial Rounded MT Bold" size:(36.0)]; 



    UIView *myLabel = (make a view and add "theLabel" to it) 


    UIBarButtonItem *myBarButtonItem = [[UIBarButtonItem alloc] initWithCutomView:myLabel]; 
    [self.navigationController.navigationItem setRightBarButtonItem:myBarButtonItem animated:NO] 

}