NavigationBar delay updating barTintColor iOS10

Try this code: Note: Code Tested in Swift 3. In ViewController A: override var isViewLoaded: Bool { title = “View 1” navigationController?.navigationBar.barTintColor = .blue navigationController?.navigationBar.isTranslucent = true navigationController?.navigationBar.tintColor = UIColor.white navigationController?.navigationBar.titleTextAttributes = [NSForegroundColorAttributeName:UIColor.white] UIApplication.shared.statusBarStyle = .lightContent self.navigationController?.navigationBar.barStyle = .black // In case statusbar Light content wont work. return true } In ViewController B: override var … Read more

Transparent iOS navigation bar

You can apply Navigation Bar Image like below for Translucent. Objective-C: [self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; //UIImageNamed:@”transparent.png” self.navigationController.navigationBar.shadowImage = [UIImage new];////UIImageNamed:@”transparent.png” self.navigationController.navigationBar.translucent = YES; self.navigationController.view.backgroundColor = [UIColor clearColor]; Swift 3: self.navigationController?.navigationBar.setBackgroundImage(UIImage(), for: .default) //UIImage.init(named: “transparent.png”) self.navigationController?.navigationBar.shadowImage = UIImage() self.navigationController?.navigationBar.isTranslucent = true self.navigationController?.view.backgroundColor = .clear

UINavigationBar custom back button without title

It’s actually pretty easy, here is what I do: Objective C // Set this in every view controller so that the back button displays back instead of the root view controller name self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@”” style:UIBarButtonItemStylePlain target:nil action:nil]; Swift 2 self.navigationItem.backBarButtonItem = UIBarButtonItem(title: “”, style: .Plain, target: nil, action: nil) Swift 3 self.navigationItem.backBarButtonItem … Read more

Trying to handle “back” navigation button action in iOS

Try this code using VIewWillDisappear method to detect the press of The back button of NavigationItem: -(void) viewWillDisappear:(BOOL)animated { if ([self.navigationController.viewControllers indexOfObject:self]==NSNotFound) { // Navigation button was pressed. Do some stuff [self.navigationController popViewControllerAnimated:NO]; } [super viewWillDisappear:animated]; } OR There is another way to get Action of the Navigation BAck button. Create Custom button for UINavigationItem … Read more

Make UINavigationBar transparent

If anybody is wondering how to achieve this in iOS 7+, here’s a solution (iOS 6 compatible too) In Objective-C [self.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:UIBarMetricsDefault]; self.navigationBar.shadowImage = [UIImage new]; self.navigationBar.translucent = YES; In swift 3 (iOS 10) self.navigationBar.setBackgroundImage(UIImage(), for: .default) self.navigationBar.shadowImage = UIImage() self.navigationBar.isTranslucent = true In swift 2 self.navigationBar.setBackgroundImage(UIImage(), forBarMetrics: .Default) self.navigationBar.shadowImage = UIImage() self.navigationBar.translucent … Read more

How do I change the title of the “back” button on a Navigation Bar

This should be placed in the method that calls the ViewController titled “NewTitle”. Right before the push or popViewController statement. UIBarButtonItem *newBackButton = [[UIBarButtonItem alloc] initWithTitle:@”NewTitle” style:UIBarButtonItemStyleBordered target:nil action:nil]; [[self navigationItem] setBackBarButtonItem:newBackButton]; [newBackButton release];

iPhone Navigation Bar Title text color

Modern approach The modern way, for the entire navigation controller… do this once, when your navigation controller’s root view is loaded. [self.navigationController.navigationBar setTitleTextAttributes: @{NSForegroundColorAttributeName:[UIColor yellowColor]}]; However, this doesn’t seem have an effect in subsequent views. Classic approach The old way, per view controller (these constants are for iOS 6, but if want to do it per … Read more