如何更改状态栏提示的文本颜色?

时间:2012-04-23 12:43:32

标签: objective-c cocoa-touch xcode4 ios4

是否有可能在Cocoa Touch中更改导航栏提示的文本颜色(即带有可选说明的区域)?可以使用此

更改文本
[self.navigationItem setPrompt:@"My Prompt"];

但是这个文字的颜色怎么样?感谢。

1 个答案:

答案 0 :(得分:-1)

您可以在导航中添加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]

}
相关问题