iphone - Custom behavior when "back" button in nav bar pressed -


i know can add custom "back" button uinavigationbar, doing removes existing button tapered left side, described in what happens when button pressed in navigationbar

is there way keep existing behavior , of button, informed when pressed?

basically, want app play sound whenever button touched. can uitabbarcontroller via delegate, delegate uinavgationbarcontroller has no such functionality.

the following possibilities view controller disappear.

  1. clicking on button (other backbarbuttonitem).
  2. clicking on backbarbuttonitem

either case viewwilldisappear: method called. keep boolean flag. lets name isanybuttonclicked. , set isanybuttonclicked = yes whenever button clicked. , override viewwilldisappear: method, , play sound if no button clicked(ie., isanybuttonclicked == no). viewwilldisappear: like,

- (void)viewwilldisappear:(bool)animated {      [super viewwilldisappear:animated];      if (!isanybuttonclicked) {          // play sound         isanybuttonclicked = no;     } } 

Comments

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -