本文介绍了何时调用layoutSubviews方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在浏览,提到以下方法:
I am going through a tutorial that mentions the following method:
-(void)layoutSubviews
位于CustomerCell.m
located in CustomerCell.m
此方法何时调用应用执行?是自动调用吗?我没有看到任何回调。
When is this method called during the app execution? Is it automatically invoked? I dont see any callback.
推荐答案
你会找到答案
编辑:直接从博客中复制:
copied directly from the blog:
- init不会导致调用layoutSubviews(duh)
- addSubview导致在视图上调用layoutSubviews正在添加,它被添加到(目标视图)的视图,以及目标视图的所有子视图
- setFrame智能调用视图上的layoutSubviews,只有在尺寸参数为框架是不同的
- 滚动UIScrollView导致在scrollView上调用layoutSubviews,并且它是superview
- 旋转设备只调用父项上的layoutSubview view(响应的viewControllers主视图)
- removeFromSuperview - 仅在superview上调用layoutSubviews
- init does not cause layoutSubviews to be called (duh)
- addSubview causes layoutSubviews to be called on the view being added, the view it’s being added to (target view), and all the subviews of the target view
- setFrame intelligently calls layoutSubviews on the view having it’s frame set only if the size parameter of the frame is different
- scrolling a UIScrollView causes layoutSubviews to be called on the scrollView, and it’s superview
- rotating a device only calls layoutSubview on the parent view (the responding viewControllers primary view)
- removeFromSuperview – layoutSubviews is called on superview only
这篇关于何时调用layoutSubviews方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!