UIBarButtonItem: target-action not working?

Posted by Jacob Relkin on Stack Overflow See other posts from Stack Overflow or by Jacob Relkin
Published on 2010-05-09T02:45:04Z Indexed on 2010/05/09 2:48 UTC
Read the original article Hit count: 547

Filed under:
|
|

Hey fellas,

I've got a custom view inside of a UIBarButtonItem, set by calling -initWithCustomView.

OK, so the view renders fine, but when I tap it, it doesn't call the method that I set as the UIBarButtonItem's action property.

Oh, and I have verified that my -deselectAll method works fine.

Here's my code:

 UIImageView *SOCImageView = [[ UIImageView alloc ] initWithImage:[ UIImage imageNamed: @"cancel_wide.png" ] ];
 SOItem.leftBarButtonItem = [[ UIBarButtonItem alloc ] initWithCustomView: SOCImageView ];
 [ SOCImageView release ];
 [ SOItem.leftBarButtonItem setTarget: self ];
 [ SOItem.leftBarButtonItem setAction: @selector( deselectAll ) ];

Thanks a million

© Stack Overflow or respective owner

Related posts about iphone

Related posts about objective-c