I've got a custom view inside of a UIBarButtonItem
, set by calling -initWithCustomView
.
My bar button item renders fine, but when I tap it, it doesn't invoke the action on my target object.
Here's my code:
UIImageView *imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"someImage.png"]];
UIBarButtonItem *bbItem = [[UIBarButtonItem alloc] initWithCustomView:imageView];
self.navigationItem.leftBarButtonItem = bbItem;
[imageView release];
[bbItem setTarget:self];
[bbItem setAction:@selector(deselectAll)];
See Question&Answers more detail:os