I am having back button and edit button on my navigation bar like below

After clicking on the Edit button, I have

My question : how can I disable click on back button when I am in edit mode so that user can not go back previous screen until he or she is done…..
What I am trying is
self.navigationItem.backBarButtonItem.enabled = NO;
but the back button is still clickable
PS : The way I add back button to navigation bar is
self.navigationItem.hidesBackButton = NO;
I can hide back button but I dont want that option…
Please advice me on this issue. Any comments are welcomed here.
The best solution would be to end edit mode when you are leaving the screen, maybe displaying a confirmation alert first (
UIAlertViewwith two buttons “Ok” and “Cancel”).However, to answer the question – you would have to create a
UIButtonwith the same appearance as a back button (using images). Create aUIBarButtonItemwith this button as its custom view and use it inleftBarButtonItem(note thatbackBarButtonItemcannot have custom views).Then you would be able to set
enabledtoNOon that custom view.EDIT: I was wrong.
UIBarButtonItemhasenabledproperty. The problem with disabling the back button was there probably because you were disablingbackBarButtonItemon the wrongnavigationItem. The back button is always defined by the previous controller in the stack.