Can anyone tell that what these 4 methods definition and what they do
1. setNeedLayout
2. setNeedDisplay
3. layoutSubViews
4. layoutIfNeeded.
I googled a lot can't find a good answer.
Can anyone tell that what these 4 methods definition and what they do
1. setNeedLayout
2. setNeedDisplay
3. layoutSubViews
4. layoutIfNeeded.
I googled a lot can't find a good answer.
setNeedsLayout
is useful for calling the 4th one layoutIfNeeded
. It makes it really needed.setNeedsDisplay
makes drawRect
method called at the next run loop iteration and is not really related to the rest of three methods in questionlayoutSubviews
performs actual layout of the view's subviewslayoutIfNeeded
calls layoutSubviews
when it is needed. You can make it needed by using the 1st method setNeedsLayout