ios - How is layoutIfNeeded used? -


How and when is done layout is encrypted ? I know that when we change the layout of a scene, we can call the setNeedsLayout to update the layout but are not sure when layout is encrypted must be used.

Note: I have the layoutIfNeeded used in the actual code but forgot how it was used in the context.

Assume that you have overridden layoutSubviews , and UIKit It seems that your scene is necessary.

Layout for any reason (like you called setNeedsLayout handling some user actions). After this, your custom layoutSubviews method will be called immediately when it is called in the normal UIKit run loop event sequence (after event handling, but before drawRect: ).

    Why may you need to call layoutIfNeeded in running a run:

    1. You can add a custom view Can change the size of the table view setNeedsLayout with custom layout is set to be called layout previews later
    2. A controller object tells the table to scroll the view from a particular cell, when user events.
    3. Your custom view table displays some custom shape views in layoutSubviews that changes the table view size.

    The problem occurs when the controller asked to scroll the table view (step 2), the boundaries of the table view were stale. The updated limit will be set to the table view later on (Step 3). What do the controllers want to see if the table view actually appears, then layoutSubviews will be a solution to call the controller LayoutIfNeeded where this is probably Could.


Comments

Popular posts from this blog

c# - ListView onScroll event -

PHP - get image from byte array -

Linux Terminal Problem with Non-Canonical Terminal I/O app -