If you rewrite these two class methods in a Uiviewcontroller, you will find a phenomenon in this controller:
1, in the same place:
(1) These two class methods are called before Init.
(2) No matter how many times you use this class in the app, the two class methods will only be called once
2, differences:
(1) load is called before initialize
(2) More specifically, if you do not use the controller you have rewritten. The load class method that you override will also be called. In other words, the load method was called before the Didfinishlaunchingwithoptions method. Magic
3, Usage: Load class method, song not used. Just used the Initialize class method. So ...
A golden application of the Initialize class method:
Often in an app, the navigation bar controller's navigation bars are almost uniform. Plus, in general, an app app overrides a navigation controller class. Then the Initialize class method will be able to play. For example:
+ (void) Initialize {
NSLog (@ "%s:%s", __file__,__func__);
Set the navigation bar theme
Uinavigationbar *navbar = [Uinavigationbar appearance];
Next, you can take the navbar to sit on a variety of unified settings processing. For example, font, background ....
}
Dear God, if this blog is inappropriate, hope to ask QQ:771722918.
Initialize and load two class methods in iOS simple comprehension