how can I make a popover and arrow with presentPopoverFromRect?

ohho picture ohho · Jun 5, 2010 · Viewed 9.9k times · Source

I don't understand how to define the (CGRect)rect in order to control the position of popover, and the position of the arrow.

For example, I have a 1004 x 768 view, how can I put the popover at lower right of the screen, and point the arrow at 700 (x) 1000 (y)?

Answer

Tamara picture Tamara · Oct 20, 2010

Nickthedude is right about presentpopoverfromrect, but there is one essential moment with presentpopoverfromrect function: if you don't set popover's contentSizeForViewInPopover property it use defult values - 320*1100 points. And if you popover's rect doesn't fit into screen coordinates (with your coordinates got from the presentpopoverfromrect rect), system places your popover to rectangle which it considered as more optimal.