2010-07-16 75 views
2

我有一个UIScrollView其中的内容大小比框架大。我显示UIPopoverController并希望使用一个UIImageView的框架调用来设置使酥料饼将被放置:将uiscrollview contentview位置映射到其框架?

[popoverController presentPopoverFromRect: imageView.frame inView: self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES]; 

这工作得很好。如果我没有在所有的滚动。但是一旦我开始滚动,imageview的框架就不在scrollview的框架之内,所以popover总是显示在不正确的y轴上。

有没有办法将这个位置映射到正确的位置?

回答

1

您是否尝试过使用- (CGRect)convertRect:(CGRect)rect toView:(UIView *)view

喜欢的东西:

CGRect convertedFrame = [scrollView convertRect:imageView.frame toView:self.view]; 
[popoverController presentPopoverFromRect:convertedFrame inView: self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];