width and height in presentPopoverFromRect?
In presentPopoverFromRect:inView:permittedArrowDirections:animated:
, method of UIPopoverViewController
, for "presentPopoverFromRect
", what I have understood is that "x
" and "开发者_StackOverflow中文版y
" are where it will point its anchor but what "width
" and "height
" parameter will do?
I am playing with them by setting different values and result is very confusing.
Call the setPopoverContentSize:animated:
method on your UIPopoverController
object, and that will set the height and width of your popover.
The position of the UIPopoverController is controlled by the presentPopoverFromRect:inView:permittedArrowDirections:animated:
method.
This is confusing, and the Apple documentation doesn't make it any clearer:
http://developer.apple.com/library/ios/#documentation/uikit/reference/UIPopoverController_class/Reference/Reference.html
ott started you in the right direction... presentPopoverFromRect uses a CGRect object as its anchor. What I learned by reading other posts here, is that the CENTER of that rectangle is used as the anchor position for the UIPopoverController, not its x,y coordinates. Although, I'm uncertain whether that varies based on permittedArrowDirections (I'm using zero for that). All the apple documentation says is "The rectangle in view at which to anchor the popover window."
To make it operate nearly like point coordinates, I've been using width=1 and height=1 for my anchor rect size.
Hope that helps!
精彩评论