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];

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

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

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

Creating a left-arrow button (like UINavigationBar’s “back” style) on a UIToolbar

I used the following psd that I derived from http://www.teehanlax.com/blog/?p=447 http://www.chrisandtennille.com/pictures/backbutton.psd I then just created a custom UIView that I use in the customView property of the toolbar item. Works well for me. Edit: As pointed out by PrairieHippo, maralbjo found that using the following, simple code did the trick (requires custom image in bundle) … Read more

Changing navigation bar color in Swift

Navigation Bar: navigationController?.navigationBar.barTintColor = UIColor.green Replace greenColor with whatever UIColor you want, you can use an RGB too if you prefer. Navigation Bar Text: navigationController?.navigationBar.titleTextAttributes = [.foregroundColor: UIColor.orange] Replace orangeColor with whatever color you like. Tab Bar: tabBarController?.tabBar.barTintColor = UIColor.brown Tab Bar Text: tabBarController?.tabBar.tintColor = UIColor.yellow On the last two, replace brownColor and yellowColor with … Read more

How to hide a navigation bar from first ViewController in Swift?

If you know that all other views should have the bar visible, you could use viewWillDisappear to set it to visible again. In Swift: override func viewWillAppear(_ animated: Bool) { super.viewWillAppear(animated) navigationController?.setNavigationBarHidden(true, animated: animated) } override func viewWillDisappear(_ animated: Bool) { super.viewWillDisappear(animated) navigationController?.setNavigationBarHidden(false, animated: animated) }

How to hide UINavigationBar 1px bottom line

For iOS 13: Use the .shadowColor property If this property is nil or contains the clear color, the bar displays no shadow For instance: let navigationBar = navigationController?.navigationBar let navigationBarAppearance = UINavigationBarAppearance() navigationBarAppearance.shadowColor = .clear navigationBar?.scrollEdgeAppearance = navigationBarAppearance For iOS 12 and below: To do this, you should set a custom shadow image. But for … Read more