How to hide 'Back' button on navigation bar on iPhone?
Objective-C:
self.navigationItem.hidesBackButton = YES;
Swift:
navigationItem.hidesBackButton = true
Swift - How to hide back button in navigation item?
According to the documentation for UINavigationItem
:
self.navigationItem.setHidesBackButton(true, animated: true)
Hide back button in navigation bar with hidesBackButton in Swift
Try adding this:
let backButton = UIBarButtonItem(title: "", style: .Plain, target: navigationController, action: nil)
navigationItem.leftBarButtonItem = backButton
How can I hide the back arrow in the navigation bar's back button?
If you do ,
navigationController?.navigationBar.backIndicatorImage = nil
navigationController?.navigationBar.backIndicatorTransitionMaskImage = nil
or
navigationController?.navigationBar.backIndicatorImage = UIImage(named: "")
navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage(named: "")
Then by default iOS use <
as default image.
To remove this image you need to add blank transparent image. I used sample from here and google image reference is here
Now reduce the image pixel size to (1,1)
and add in your assets and use below code.
navigationController?.navigationBar.backIndicatorImage = UIImage(named: "Blank")
navigationController?.navigationBar.backIndicatorTransitionMaskImage = UIImage(named: "Blank")
Here Blank is the same image name in my asset.
UINavigationBar Hide back Button Text
In the interface builder, you can select the navigation item of the previous controller and change the Back Button
string to what you'd like the back button to appear as. If you want it blank, for example, just put a space.
You can also change it with this line of code:
[self.navigationItem.backBarButtonItem setTitle:@"Title here"];
Or in Swift:
self.navigationItem.backBarButtonItem?.title = ""
How to completely remove back button from navigation bar?
Note:Problem solved with just comment. But posting this as answer so that It will help someone else having same issue.
I too had same problem with navigationBarButtonItem
while adding custom barButtonItem
to navigationBar
in storyboard. If you are also using storyboard then just set navigationBar
tint color as clear color in navigationController
. By setting clear color, that weird default navigation back button will not appear anymore.
Related Topics
Uiviewcontroller In-Call Status Bar Issue
How to Express Strings in Swift Using Unicode Hexadecimal Values (Utf-16)
Avcapturesession Audio Doesn't Work for Long Videos
Massive Memory Leak in iOS Uiwebview
Alert View Is Showing White Rectangle in iOS7
Multiple Locations on Map (Using Mkmapitem and Clgeocoder)
Ios:Retrieve Rectangle Shaped Image from the Background Image
How to Convert an Uiimage to Grayscale in Swift Using Cifilter
Fbsdkaccesstoken Currentaccesstoken Nil After Quitting App
How to Convert an Int to a Character in Swift
Searchdisplaycontroller Deprecated in iOS 8
Uitableview Auto Resizing Row Constraint Breaking Mysteriously on iPhone 6Plus
Get the Frame of Uibarbuttonitem in Swift
Application Not Automatically Launching in Device and Getting Error on Xcode
What Is MACh-O Type Should I Use It in My iOS Objective-C Project
Alternative to Usernotificationcenterdelegate's Willpresent When App Is in Background