I have created a navigation controller. In the second view (which is pushed), I have some webservice call and placing a overlay view and setting
self.view.use
You can do the following if you are running on Swift
self.navigationItem.rightBarButtonItem?.enabled = true
This snippet will disable the button.
Swift 5 & iOS 13 :
To remove all left buttons or just a specified one just remove from leftBarButtonItems
Array.
self.navigationItem.leftBarButtonItems = []
- (void)viewDidLoad
{
[super viewDidLoad];
self.navigationItem.leftBarButtonItem=nil;
self.navigationItem.hidesBackButton=YES;
}
I solved this by just adding a property to my viewcontroller:
@property (nonatomic, strong) IBOutlet UIBarButtonItem * RightButton;
I then connected it to the button on the storyboard. You can then at will set its properties like:
self.RightButton.enabled=true;
Try this code:
UIApplication.sharedApplication().beginIgnoringInteractionEvents()
This will stop user to interaction with app and after service call, write this code again:
UIApplication.sharedApplication().endIgnoringInteractionEvents()
Sure this will help.
Latest Swift: To hide the back button, you MUST use:
self.navigationItem.setHidesBackButton(true, animated: false)
Note: This can trigger a bug in the navigation bar that can cause an artifact to appear in place of a hidden back button when transitioning to a view that doesn't have a back button (or has a leftButton in its place). The artifact that appears is either ellipses "..." or the title of the previous viewController on the stack. I believe this bug to be related to the bug documented in apple's own sample code project "CustomizingUINavigationBar", CustomBackButtonViewController.m