开发者

How does a subview frame change if I transform the view frame?

开发者 https://www.devze.com 2023-01-18 02:23 出处:网络
I have to do t开发者_C百科his: 1:CGRect originalSubviewFrame = subview.frame; 2:view.frame = (CGRect)newFrame;

I have to do t开发者_C百科his:

1:CGRect originalSubviewFrame = subview.frame;
2:view.frame = (CGRect)newFrame;
3:subview.frame = originalSubviewFrame;

I think instructions 1 and 3 shouldn't be there but if I don't restore the subview shape, it change for some reason!?!? I read the documentation but it's unclear.


If subview is a subview of view then whether it's frame changes when view's frame changed depends on whether view.autoresizesSubviews is YES and if so, how that manifests is determined by subview.autoresizingMask.

I encourage you to read the UIView documentation regarding those two properties.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号