请看下面的图片:
在这里,我想要将我的 UITextField
C 透视图的 CGPoint
获取到主 UIViewController
Z。我正在从主 UIViewController
Z 转换它的位置,如下所示:
CGPoint pointInTable = [Cell.inputTextField.superview convertPoint:Cell.inputTextField.frame.origin toView:self.view];
但我认为我必须根据每个 subview 的直接父 View 来转换它。但如何呢?
如果有人知道答案,请与我分享。
非常感谢。
最佳答案
您可以在同一层次结构中的任意两个 View 之间直接进行转换。
[self.view convertPoint:CGPointZero fromView:Cell.inputTextField];
关于ios - 如何通过 convertPoint toview 从父 View 中找出 subview 的确切位置,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33996937/