I have a UIBarButtonItem
with UIButton
as custom view.
The UIButton
has a addTarget:action:
on it. In the action
Let's say you have added the UIButton aButton to UIBarButtonItem info_Button as following:
//Add a button on top of the UIBarButtonItem info_button
UIButton *aButton = [UIButton buttonWithType:UIButtonTypeInfoLight];
[aButton addTarget:self action:@selector(showInfo:) forControlEvents:UIControlEventTouchUpInside];
info_Button.customView = aButton;
Now, in showInfo, presentPopoverFromBarButtonItem:info_Button(instead of presentPopoverFromBarButtonItem:sender), this will pass the UIBarButtonItem info_button to make pop over works:
- (IBAction)showInfo:(id)sender
{
[self.flipsidePopoverController presentPopoverFromBarButtonItem:info_Button permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}