开发者

How do I find the frame of a UIView in the context of a UIScrollView?

开发者 https://www.devze.com 2023-01-22 07:48 出处:网络
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.

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消