两个UIViews外面最小的矩形 - ObjectiveC

Cha*_*nte 0 iphone objective-c uiview ipad ios

我有两个UIViews,我需要画一个矩形(或)得到最小矩形的框架UIViews.我怎么能得到这个?

mat*_*hat 6

您可以使用:

CGRect smallestRectangle = CGRectUnion(view1.frame, view2.frame);
Run Code Online (Sandbox Code Playgroud)

根据文档,这个功能

返回包含两个源矩形的最小矩形.