UIBarButtonItem: target-action not working?
- by Jacob Relkin
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