Question

At the bottom of the Detail View Controller of a Split View Controller, I have added a Toolbar in the Storyboard. I have added three Bar Button Items in this Toolbar. Each Bar Button Item is hooked to its IBOutlet in the private interface of the Details View Controller, and also hooked to its IBAction implementation in the same controller, for example:- (IBAction)shouldPresentView:(UIBarButtonItem *)sender

The main view contains:

  • A Webview.
  • A small rectancgle view at the bottom of the screen, below the webview, created and added programmatically, and containing various buttons. All the buttons stay operational.

When touching any of the Bar Button Items, the button is temporary highlighted, but none of the IBAction methods is triggered (a NSLog() statement in every method is never executed).

After searching and reading equivalent topics, I went through several solutions:

  • I added manually the Details View Controller as the delegate of the Toolbar in the View Did Load method of the Details View Controller.
  • I emptied the cache of the Derived Data of the Product.
  • I checked that every IBOutlet has an address and is not nil.
  • I tried to add an action SEL manually in the View Did Load method for every Bar Button Item.
  • I removed the rectangle bottom view to be sure that it was not interfering with the responder chain.
  • I added a Bar Button Item in the Navigation Bar to check if the same problem occurs: no, the Bar Button Item fires the IBAction method.

Any help would be appreciated.


Developing with iOS 7 SDK in Xcode 5.0.2

Was it helpful?

Solution

The issue was coming from a Tap Gesture that I added to the main view to collect touches on the web view. So the touch on the Bar Button Items was probably captured somewhere by the main view before reaching the UIButtonBarItem. I changed the target of the Tap Gesture to the web view – more logical – and the issue has been solved.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top