在 UIView 中,我可以像这样获取对象的 CGpoint:
x = self.object.frame.origin.x;
y = self.object.frame.origin.y;
但是当我的对象在 scrollView 中时使用此代码时,我得到了与在 UIView 中相同的 x 和 y。那么当我在 scrollView 中时如何确定对象 CGPoint。
最佳答案
CGPoint pointOfSubviewAccoringToSelfView = [self.view convertPoint:self.subview.frame.origin fromView:self.scrollView];
关于iOS:如何确定 ScrollView 中对象的 CGPoint,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21831301/