[Manually create UIWindow Objective-C language]
Mobile
2023-12-16 19:21:53
views: null
1. In the last class, we talked about lazy loading of controller View:
1. When will this lazy loading be called? Use us directly, controller self.view
When self.view:
When, call it self.view,
We need to load the controller's view.
self.view loads the view of the controller
We have demonstrated this to everyone, and everyone is already clear about this. We have told you a detail, which is the issue of color, right?
Let me explain the color issue again.
Here we are, hmVc "dot" view "dot" backgroundColor:
What is the order of execution of this?
First of all, does hmVc's "point" view require the controller's view?
At this time, let’s not talk about the color. The color has not arrived yet.
You load the view first, then the color last.
So, let’s look at the view first.
view, how to load it?
First go to the controller:
loadView:
Load the view,
Then, viewDidLoad, the view is truly available.
After you have it, you change its color inside, to green, right?
Here, a color is assigned,
Here, a color is assigned, and then, back to the Delegate,
Now, is this view considered real?
At this time, I gave it another color, red.
Changed it to red,
So it finally displays in red,
But, when we debug through breakpoints:
Also add a breakpoint at the bottom:
Also add a breakpoint in the controller:
command + R:
Take one:
1) Create a controller
2) Set the view's color to red,
hmVc "dian" view, when encountering this "dian", enter the controller:
3) In the controller, execute loadView:
Is the view loaded now?
4) Then, in viewDidLoad::
At this time, if I jump again, it will no longer stay on this line:
I won’t stay in this business anymore.
Then this background color, once assigned,
It's equivalent to passing directly.
Look, as soon as you leave, it reaches line 31:
Isn’t that right? We went directly to line 31.
So, some students may have questions about this color.
Let me explain it clearly to everyone,
Okay, this is our lazy loading of the view of this controller.
Origin blog.csdn.net/madoca/article/details/134291663