需要更改标题导航栏颜色

时间:2014-08-27 04:02:10

标签: ios objective-c

需要更改导航栏标题颜色。 这样的事情:

self.navigationItem.title.color = [UIColor yellowColor];

2 个答案:

答案 0 :(得分:3)

-(void)viewDidLoad
{

    NSShadow *shadow = [[NSShadow alloc] init];

    shadow.shadowColor = [UIColor colorWithRed:0.0 green:0.0 blue:0.0 alpha:0.8];

    shadow.shadowOffset = CGSizeMake(0, 1);
// In dictionary you can set your own color

    [[UINavigationBar appearance] setTitleTextAttributes: [NSDictionary dictionaryWithObjectsAndKeys:[UIColor colorWithRed:245.0/255.0 green:245.0/255.0 blue:245.0/255.0 alpha:1.0], NSForegroundColorAttributeName,shadow, NSShadowAttributeName,[UIFont fontWithName:@"HelveticaNeue-CondensedBlack" size:21.0], NSFontAttributeName, nil]];

}

了解更多...

转到http://www.appcoda.com/customize-navigation-status-bar-ios-7/

答案 1 :(得分:0)

希望这会对你有所帮助

你可以通过

给你想要的任何时尚的导航栏
UILabel *lblNavTitle = [[UILabel alloc] initWithFrame:CGRectMake(x, y, width, height)];
    lblNavTitle.backgroundColor = [UIColor clearColor];
    lblNavTitle.textAlignment = NSTextAlignmentCenter;
    lblNavTitle.textColor = [UIColor whiteColor];//this what you want
    lblNavTitle.text = NSLocalizedString(@"Volunteers", @"");
    [lblNavTitle sizeToFit];
     self.navigationItem.titleView = lblNavTitle;