0

I'm developping an iPad App and need to present a popover from a button located in each footer of a grouped tableview with a variable amount of sections (up to 100). How do I set the anchor for the popover to the pressed button, when in every section the same button property is being loaded?

Any idea much appreciated.

Edit: I'm an idiot for being unspecific. I actually have a toolbar loaded in the footerView of each section and need to identify the right UiBarButtonItem. Any Idea??

L00ps
  • 113
  • 2
  • 9

1 Answers1

0

We use this message of UIPopoverController object to present a popover

 *YOURPOPOVERCONTROLLER* presentPopoverFromRect:
                                         inView:
                       permittedArrowDirections:
                                       animated:

You can send the frame of the button as argument to presentPopoverFromRect.

Puneet Sharma
  • 9,369
  • 1
  • 27
  • 33
  • Ah I see, I took the wrong presentPopover message. Can't wait to try when @home. Thank you! – L00ps May 23 '13 at 09:49
  • You shurely answered my question correctly. Sadly, it was me asking the wrong question. I load a toolbar with transparent backgroundimage to the footerView. How can I detect an UIBarButtonItem from the there? It seems to always take the last section which makes sense because it always loads the same reference. I would need to pass the section with the action? – L00ps May 23 '13 at 12:16
  • Lets say - (IBAction)barButtonPressed:(id)sender is your method that is called when you press any barButton on Section Footer. You can get your bar button from sender UIBarButtonItem *barButton = (UIBarButtonItem *)sender; and use presentPopoverFromBarButtonItem:barButton to present the popover. The Popover now should present from the pressed barButton. PS: I have written it without XCode so pardon me fro typos. – Puneet Sharma May 23 '13 at 13:22
  • Sorry, couldn't check earlier. Works perfectly. Thank you! – L00ps May 24 '13 at 17:11