Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how can I make a popover and arrow with presentPopoverFromRect?

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)?

like image 289
ohho Avatar asked Jun 05 '10 13:06

ohho


People also ask

How to create a popover on hover event in HTML?

So, create an element that you want to have a popover on hover event with a class name "popover__title". Similarly, create a div element with a class name "popover__content" and place your content inside it. Wrap all these elements into a div tag and define its class name "popover__wrapper". The complete HTML code for a basic popover is as follows:

How do I enable all popovers in the document?

The following code will enable all popovers in the document: By default, the popover will appear on the right side of the element. Use the data-placement attribute to set the position of the popover on top, bottom, left or the right side of the element:

How do I put a popover on the right side?

Positioning Popovers. By default, the popover will appear on the right side of the element. Use the data-placement attribute to set the position of the popover on top, bottom, left or the right side of the element: <a href="#" title="Header" data-toggle="popover" data-placement="top" data-content="Content">Click</a>.

How to create a speech bubble/arrow icon for the Popover content?

So, use the CSS visibility hidden property and 0 value for the opacity. Use the “before” pseudo-selector and define the following styles in order to create the speech bubble/arrow icon for the popover. Make the popover content visible with the hover pseudo-selector.


1 Answers

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.

like image 186
Tamara Avatar answered Nov 13 '22 01:11

Tamara