Author Topic: How to display the back button as an arrow with no text  (Read 8742 times)

kjmcneish

  • Administrator
  • *****
  • Posts: 719
    • View Profile
How to display the back button as an arrow with no text
« on: January 21, 2015, 10:14:14 AM »
To display the navigation bar's back button as an arrow with no text, add the following code to the viewDidLoad method of the view controller you are navigating back to:

In Swift:
Code: [Select]
self.navigationItem.backBarButtonItem = UIBarButtonItem(title: "", style: UIBarButtonItemStyle.Plain, target: nil, action: nil)
In Objective-C:
Code: [Select]
self.navigationItem.backBarButtonItem =
    [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil];

All the best!
Kevin McNeish
Author of "Learn to Code in Swift": https://itunes.apple.com/us/book/learn-to-code-in-swift/id942956811?mt=11
« Last Edit: August 22, 2015, 05:38:48 PM by kjmcneish »