Search This Blog

Sunday, October 30, 2016

iOS Swift. How to hide back Button Text in UINavigationBar


By default in Navigation Controller the title of back button of current view controller is the title of previous view controller. But what if we want not show any text for back button and show only symbol "<". For that purpose we have to replace in first view controller back button for navigation item.

import UIKit

class ParentViewController: UIViewController {

    override func viewDidLoad() {
        super.viewDidLoad()
        
        // Remove title from back button. Now only "<" symbol will be show as back button.
        let backButton = UIBarButtonItem(title: "", style: .plain, target: nil, action: nil)
        self.navigationItem.backBarButtonItem = backButton
    }

}

Standard "back button"




No text Back Button




6 comments:

  1. There are many articles circulating on internet that exaggerate about Custom Website. But your article is an exception that made me understand it without any difficulty.

    ReplyDelete
  2. Thank you for writing this blog and giving this vital and useful information. Best Custom Websites

    ReplyDelete
  3. Thank you for writing this quality informational content.Your writing technique is impressive and enjoyable to read. I'll come back for more fantastic material.
    Best wishes, and good luck.
    Custom Build Website

    ReplyDelete
  4. Good content. I was looking for this type of content. Saved my time for further search.
    You should always provide that type of content. I appreciate your determination to give the students a good title.Custom Designed Websites

    ReplyDelete
  5. This post is quite attractive and well-kept, and it needs to be recognised. Thank you for your time and effort, and please keep the information coming.
    SEO Services NYC

    ReplyDelete