0

I know I can create a UIButton and init the UIBarButtonItem with the UIButton. With this solution we can avoid the problem.

Here the solution:

How to remove/avoid small white splash light on UIBarButtonItem programatically

But I need the UIBarButtonItem for call a Popover, and popovers can only be calls from a UIBarButtonItem

[self.myPickerPopover presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

presentPopoverFromBarButtonItem:sender

Then when I'm trying to use the UIButton solution the application crash because I'm presenting the Popover from a Button and not from a BarButtonItem.

Any idea to solve the problem? Any idea to delete the light?

Thanks

4
  • 1
    But you still have an UIBarButtonItem as the "superview" of your UIButton, right? You're just setting the UIButton as the customView of the UIBarButtonItem. Have you tried to call presentPopoverFromBarButtonItem for the UIButtons's superview UIBarButtonItem ?
    – FD_
    Dec 21, 2012 at 17:23
  • 1
    See this on how to get the UIBarButtonItem from the UIButton: stackoverflow.com/a/9578399/1691231
    – FD_
    Dec 21, 2012 at 17:26
  • You are right the solution was easy. Just: [self.myPickerPopover presentPopoverFromBarButtonItem:MY BAR BUTTON ITEM HERE (not the sender) permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES]; Thanks Dec 21, 2012 at 17:47
  • I've put my comments in an answer, please accept it so that this question does not appear as unanswered on the questions list.
    – FD_
    Dec 21, 2012 at 18:00

1 Answer 1

1

Just call presentPopoverFromBarButtonItem for the UIBarButtonItem instead of your UIButton.

[self.myPickerPopover presentPopoverFromBarButtonItem:--UIBarButtonItem here, not UIButton -- permittedArrowDirections:UIPopoverArrowDirectionDown animated:YES];

See this on how to get the UIBarButtonItem from the UIButton: stackoverflow.com/a/9578399/1691231

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.