Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含多个子视图的视图。它们中的每一个都包含子视图,依此类推。向下几层是我作为对象的子视图。我想找出它在几层视图中的框架位置。我怎样才能找到这个?
我以为您的意思是视图相对于超级视图的 (x,y) 位置。如果是这种情况,您可以使用UIView' 方法– convertPoint:toView:
UIView
– convertPoint:toView:
[yourView convertPoint:yourView.frame.origin toView:yourSuperView];
希望这可以帮助!