to use a view controller:1. Create a root view controller Acontroller2. Refer to Acontroller's header file in Appdelegate, and specify Appdelegate's root view controller as Acontroller, code 3. The Appdelegate root view controller is set, but the default view of the Acontroller View controller is a blank view and the background color is a transparent color, so if you want to display the content, there are two ways: Create a view directly in the Viewdidload method And added to the root view (Viewdidload is the method that the view controller's own root view is loaded with ). The second is: overriding the method of loading the root view (Loadview method), we usually specify in this method that we want a view as the root view, and in the View controller life cycle, this method will only go once, in this method, You cannot use the Self.view getter method to get the root view. Because this view is loading, there is no real 4, usually we use the second method, because the second method, the Division of labor more explicit, the view only renders, the controller does only trigger events5, in the second way, we need to specify a view as the root view of the Acontroller, so create a view as the TA's root view6. Create a custom view as the root view of TA see the Custom view of the third article, such as creating a bview7. After creating the view, in the Loadview method override, specify that the view you created is the root view of the view controller, and remember to set it as a property such as:8. You can add events to the controls in the view in Viewdidloadmodal: Conversion of pages to each otherconversion between pages requires two view controllers: A, b1, go to the next interface B, for the view controller in the view of the button to add methods, in the method first create the next interface object, in the use of modal launch the next page, code: 2. Return to the previous interface, just need to write the modal return code in the method on the button on the view of the B controller, code: MVC Overview: Screen Detection:1, set the device to support the direction of rotation, inverted screen is not processed, the default is the horizontal screen and a positive screen are supported. method: Override the Supportedinterfaceorientations method in the view controller, and the return value is an enumeration value such as:2, the device in the direction of conversion and after the method of execution, in the View controller rewrite viewwilltransitiontosize:withtransitioncoordinator:, If you want the screen to recycle the keyboard when it spins, the code: 3, view processing: As in the direction will change in the view, overriding the Layoutsubviews method, according to the direction of the device, re-layout, code such as:Memory Warning:When the running memory of a program reaches a value, the Didreceivememorywarning method is called to determine if the root view is loaded and not displayed, and if so, set the root view to nil, The goal is to re-load the call to the Viewdidload function when it comes back
View controller, MVC, screen rotation, memory warning