When is the layoutSubviews method called?

I am experiencing a tutorial that mentions the following method:

-(void)layoutSubviews

located at CustomerCell.m

When is this method called at runtime? Is it called automatically? I do not see the callback.

+5
source share
3 answers

You will find your answer here.

EDIT: copied directly from the blog:

  • init does not call layoutSubviews (duh)
  • addSubview causes display of layoutSubviews in the added view, the view of its addition in (target view) and all subzones of the target view
  • setFrame intelligently calls layoutSubviews in a view that has its frame only if the frame size parameter is different
  • UIScrollView layoutSubviews scrollView
  • layoutSubview ( viewControllers)
  • removeFromSuperview - layoutSubviews
+12

. . .

WHEN, . , , . , . subviews, .

+1

The method layoutSubviewswill be called at any time when the system thinks that your idea should be stated again. For example, if the view frame is changed or added for viewing, etc. If you need to manually start it, you can call the method setNeedsLayout.

+1
source

All Articles