1

I've set up a UIBarButtonItem in IB, created the IBAction by dragging from IB to the header file, then just put a simple breakpoint within the action in my source file....... and nothing happens.

I'm using AVCam. I can run the action from a button, but it needs to be done on a toolbar because I'm working with sharekit. I've made toolbars before, and have never had this problem before.

I connected both the toolbar and the barbutton's objects... those both work. I can hide and unhide them freely, but for some reason I just cannot get the action to call.

Anybody got any ideas?

Jeff Stone
  • 319
  • 1
  • 4
  • 14
  • As a rule of thumb, you should link up each and every UI element in order to get stuff like this work... But again: why not add that action programmatically? –  Oct 13 '12 at 15:18
  • with a selector? can you build a bar button item and add the action programmatically? – Jeff Stone Oct 14 '12 at 15:48
  • yea well the sarcasm is lovely, but that's not what I asked. I know how to build actions programmatically, but you can't do it if you build the toolbar first in IB. So I just build the whole thing in code anyway... No thanks to you – Jeff Stone Oct 15 '12 at 18:11
  • Jeff Stone is right here. There is unnecessary sarcasm here. This is a bug. If "Storyboard ctrl-Drag to header file IBAction" claims it will do the job, it must do the job; otherwise it must say "can not do it this way, go code that functionality yourself !". This is a pure bug. it works in 8.1. Not on 7. Any luck solving it Jeff ? Have the same problem here. – Add080bbA Nov 06 '14 at 09:57
  • I created the whole thing programmatically. This project is kind of old now though, don't really remember where this was :p – Jeff Stone Nov 07 '14 at 11:22
  • Jeff hi. Think found a solution for this and many more similiar problems. i programatically added a UITapGestureRecognizer in ViewDidLoad in order to dismiss keypad. That was preventing gestures to be transfered to UIView tap.cancelsTouchesInView=NO; solved the problem. – Add080bbA Nov 12 '14 at 15:35
  • Jeff hi. Think found a solution for this and many more similiar problems. i programatically added a UITapGestureRecognizer in ViewDidLoad. That was preventing gestures to be transfered to UIView. not letting to UITabBarItem. Not to UITableViewCell Selection Event. tap.cancelsTouchesInView=NO; solved the problem. – Add080bbA Nov 12 '14 at 15:42

2 Answers2

2

I had a very similar problem with an UIBarButtonItem with outlets not working in Xcode 4.5 - no actions got send when I pushed the button, and the referencing outlet didn't reference to anything.

After some time and googling, I discovered that even more none of all the changes I made to my storyboard did have any effect, but hardcoding the GUI worked.

Finally, emptying Xcode project caches solved my problem - the description how to do this can be found here: How to Empty Caches and Clean All Targets Xcode 4

Community
  • 1
  • 1
Jan Z.
  • 6,883
  • 4
  • 23
  • 27
0

I had the same problem with Jeff. For a long time, i tried lots of useless stuff. Adding selectors programatically , bla bla bla

i also had an UITapGestureRecognizer added on viewDidLoad in order to dismiss keypad. it was not letting gestures to reach UIView. Not to UIBarButtonItem Click Event and many more Not to UITableViewCell Select Event.

This solved my problem: tap.cancelsTouchesInView=NO;

All of a sudden UITableViewCell Select started to work UIBarButtonItem Click event started to work.

My problem was occurring only (7.1) Not in (8.1)

Add080bbA
  • 1,818
  • 1
  • 18
  • 25