How do I find the frame of a UIView in the context of a UIScrollView?
I'm trying to place a UIPopoverController
to display when a UIButton
is tapped. However, the UIButton
is placed within a UIScrollView
and so its frame is of开发者_运维问答fset by the scroll amount.
Is there an easy way of finding out a view's frame as it appears in the context of the screen? Or do I just need to do a subtraction between the UIButton
frame and the contentOffset
of the UIScrollView
?
Thanks!
If you are using - (void)presentPopoverFromRect:(CGRect)rect inView:(UIView *)view permittedArrowDirections:(UIPopoverArrowDirection)arrowDirections animated:(BOOL)animated
then you are already specifying the view that you are wanting to present from. Just present the popover from 0,0 0,0 in your UIButton
.
精彩评论