I’ve tried everything I can think of here.
self.navigationBar = [[UINavigationBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)];
self.navigationBar.autoresizingMask = UIViewAutoresizingFlexibleWidth;
self.navigationBar.topItem.title = @"Title";
self.navigationItem.title = @"Title";
self.title = @"Title";
self.navigationBar.topItem.titleView.backgroundColor = [UIColor blueColor];
self.navigationController.navigationBar.topItem.title = @"Title";
[self.view addSubview:self.navigationBar];
I’ve tried all of these in the hope that one would work, but none of them have. How do i change the title of this navigation bar? This is inside the init method of a UIViewController.
You need to set your custom NavigationBar’s items array. You should pass in an array with one item that has your specified title: