ViewWillLayoutSubviews gets too many names

In mine viewController.view, I have some work done in viewWillLayoutSubviewsthat organizes the visible visible subzones that need to be brought to the forefront to hide, etc., if the orientation changes.

But I have buttons on my view that for some reason cause viewWillLayoutSubviewsfor a call at each press. Why should it be? According to Apple docs, viewWillLayoutSubviewsonly called if changes to your view change.

As a result, my views are only rebuilt with the click of a button, but I don’t rotate the device at all, and I cannot manipulate view.bounds or view.frame in any way.

+5
source share
2 answers

Better do one thing, and take a bool and set it by pressing the TRUE button and check it on layoutSubviews and act on whether it is true or false. You get what I'm trying to do.

+1
source

Its strange, I wrote a demo with only 2 methods, one for the action of the button, and one - - (void)viewWillLayoutSubviewswhen I pressed the button, - (void)viewWillLayoutSubviewsit is not called. Maybe a mistake in your code?

0
source

All Articles