2013-07-13 98 views
11

我認爲這是一個簡單的問題,但我似乎無法找到一種方法來做到這一點。在UIView中獲取不是超級視圖的視圖框架

我有一個視圖,這是我的uiviewcontroller的子視圖。在這個觀點中,我有另一種觀點。爲了澄清,這是體系結構:

>UIViewController.view 
--->Subview A 
------->Subview B 

我想內uiviewcontroller.viewsubview b框架。

這可能嗎? subviewB.frame爲我提供了Subview A內的視圖框架。

回答

34

使用UIView convertRect:toView:方法:

CGRect frameRelativeToViewControllerView = [subviewB convertRect:subviewB.bounds toView:viewController.view]; 
相關問題