What you do is equivalent to loading all the Views into the UIScrollView at once, but some are on the screen and some are beyond the screen. They are always displayed, but you can't see it. There is no Appear at all. Action, so ViewWillAppear
The answer above should be correct, I’m just here to add to it.
For this processing, you can use the proxy method of UIScrollView itself, which is the method when the drag is completed - (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:
To determine the current switching, then put your ViewWillAppear method in it and execute it.
Promise must be called~
Here is the timing of the call (for ChildController, after all, it is a complete step in the UIViewController cycle): viewWillAppear, viewDIdAppear is executing
[self.view addSubview:childController.view];
Called after
.
On the contrary, viewWillDisappear, viewDidDisappear is executing
[childController.view removeFromSuperview];
Called after
.
If you don’t believe it, you can write a simple Demo yourself and add the following operation:
What you do is equivalent to loading all the Views into the UIScrollView at once, but some are on the screen and some are beyond the screen. They are always displayed, but you can't see it. There is no Appear at all. Action, so ViewWillAppear
will not goThe answer above should be correct, I’m just here to add to it.
For this processing, you can use the proxy method of UIScrollView itself, which is the method when the drag is completed
- (void)scrollViewDidEndDragging:(UIScrollView *)scrollView willDecelerate:
To determine the current switching, then put your
ViewWillAppear
method in it and execute it.Promise must be called~
Called afterHere is the timing of the call (for ChildController, after all, it is a complete step in the UIViewController cycle):
viewWillAppear, viewDIdAppear
is executing.
On the contrary,
Called afterviewWillDisappear, viewDidDisappear
is executing.
If you don’t believe it, you can write a simple Demo yourself and add the following operation:
Rewrite in cv
viewWillAppear: viewWilDisappear:
and put LOG for verification.Please refer to the above for analysis of your actual situation~