我在 self.view
(主视图)中有一个 UIImageView
,其中有一个 UIButton
。我想知道 self.view
中 UIButton
的框架是什么,而不是 UIImageView
。
最佳答案
我猜你正在寻找这个方法
// Swift
let frame = imageView.convert(button.frame, to: self.view)
// Objective-C
CGRect frame = [imageView convertRect:button.frame toView:self.view];
关于ios - 如何在另一个 View 中获取 View 的框架?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/8082493/