qv3ehw
Last Updated: March 17, 2016
·
10.23K
· _jeffreyjackson
Profile

Custom Title in Navigation Bar

You can replace the titleView of the navigationItem. Here is a simple example using a UILabel.

- (void)viewDidLoad
{
    [super viewDidLoad];
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectZero];
    label.backgroundColor = [UIColor clearColor];
    label.font = [UIFont fontWithName:@"GoodMobiPro-CondBold" size:24];
    label.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];
    label.textAlignment = UITextAlignmentCenter;
    label.textColor = [UIColor whiteColor]; 
    self.navigationItem.titleView = label;
    label.text = @"My Custom Title";
    [label sizeToFit];
}
Say Thanks
Respond