Loadview and viewdidload are two methods that must be used in iPhone development. They can be used to initialize some content during view loading. But what are their differences?
The viewdidload method is called only when the view is initialized from the NIB file. Viewdidload is used for initialization and loading.
The loadview method is called when the Controller's view is nil. This method is used to create a view programmatically. Loadview is the method called when the view is first loaded when code is used to generate the view. Use (write) code to implement controls. Functions used to generate controls using code. For example:
-(Void) loadview {uiview * view = [[uiview alloc] initwithframe: [uiscreen mainscreen]. applicationframe]; [view setbackgroundcolor: _ color]; self. view = view; [view release];}
If you implement the loadview method in the controller, you may be called by the memory management control at some time when the application is running. If the device memory is insufficient, View
The Controller receives a message from didreceivememorywarning. The default implementation is to check whether the current controller's view is in use. If its view
The view hierarchy is not currently in use, and your controller implements the loadview method, the view will be release,
The loadview method is called again to create a new view.