First solve the problem left behind yesterday, go back at night did not look ah, a little tired.
1. The role of AppDelegate.h and APPDELEGATE.M
2. Learn more about Uiveiwcontroller
3. Uitabbarcontroller
4. @protocol and @optional properties in controller files
5. Uicontroller
--------------------(I'm a split line)
1. main.m This file first
#import <UIKit/UIKit.h>#import"AppDelegate.h"int Main (intChar * argv[]) { @autoreleasepool { returnclass ])); }}
The default iOS program starts with the main function, and it contains a method. There are four parameters inside a method.
The function of the parameter can be viewed by holding down the option key.
ARGC and argv: The number of parameters and the contents of the parameters.
The third parameter represents the UIApplication class (or subclass) string, which defaults to nil and is equivalent to Nsstringfromclass ([UIApplication class]). UIApplication is a singleton mode in which an application has only one UIApplication object or sub-object;
The fourth parameter is the proxy class string for UIApplication, which is generated by default for the Appdelegate class.
The role of the Appdelegate class: This class is primarily used to listen to events across the entire application life cycle. The corresponding method in the proxy is invoked when an event is raised during the uiapplication run.
method Execution- that is, when the Uiapplicationmain method is executed, the method creates a corresponding UIApplication object based on the third parameter. This object creates and formulates this object as a proxy for uiapplication according to the fourth parameter appdelegate, while uiapplication opens a message loop that constantly listens to the activities of the application. When the application life cycle changes uiapplication the proxy corresponding method is called.
Application uiapplication is interactive with the outside through the proxy.
APPDELEGATE.M This class defines how individual events in the application life cycle are executed:
1. Didfinishlaunchingwithoptions: Executes after the program starts and executes only after the first program has been started and is no longer executed.
2. Applicationwillresignactive: The program is going to be activated (get focus) execution.
3. Applicationdidenterbackground: The program goes into the background and executes (loses focus before entering the background).
4. Applicationwillenterforeground: The program will be executed when it enters the foreground.
5. Applicationdidbecomeactive: The program is activated (get focus) after execution (first into the foreground and then get the focus).
6. Applicationwillterminate: The program executes at the time of termination.
The usual methods in this appdelegate.m are already known. That can be summed up again for the file structure:
1. Appdelegate (. h/.m): Application proxy, which is primarily used to listen for events at various stages throughout the application life cycle.
2. Viewcontroller (. h/.m): View controller, mainly responsible for managing the life cycle of UIView, responsible for switching between uiview, monitoring UIView events and so on.
3. Main.storyboard: The interface layout file that hosts the corresponding UIView view control.
4. Images.xcassets: Application image resource file.
5. Info.plist: Application configuration file.
6. MAIN.M: Application entry function file.
-----------------------(I'm a split line)
2. Uiviewcontroller
View Controller. I can't help but think of UIView, on the Internet to check the next. Seeing so much is not exactly what you want to know.
I think UIView it is the parent of all visual controls on the interface, such as Uilabel,uiwindow. And Uiviewcontroller, it is a view controller. It seems to me that in this file it is going to implement some method drops.
But UIView's approach is worth mentioning:
A uiview can contain many subview, that is, other uiview.
1. Add and remove Subview
[Subview Removefromsuperview]//Remove Subview from the current UIView
[UIView Addsubview:subview]//Add a Subview for UIView
2. Subview's Mobile
[UIView Bringsubviewtofront:subview]//move Subview forward one layer (with the previous layer swapped position).
[UIView sendsubviewtoback:subview]//moves the Subview backward one layer.
3. Using an index to Exchange layer levels of two Subview
[UIView exchangesubviewatindex:indexa withsubviewatindex:indexb]//Exchange two layers
4. Get the Subview index
Nsinteger index = [[UIView subviews] indexofobject:subviewname];
5. Tagging the Subview
[Subview settag:nsinteger]//plus marker
[UIView viewwithtag:nsinteger]//to get a view return value of UIView by tag
6. Remove all the subview from the UIView and list the subview in a backward order.
[UIView Subviews]
The method is to introduce the end of the drip, said these current and eggs of the thing, I should enter the subject--uiviewcontroller
Having read the discussion on the online long stories, I decided to look at the official documents of Uiviewcontroller. See if I can finish it in half an hour.
First declare that this series of posts is only a process of documenting your own learning.
I just want to say I want to be hungry to read official documents, but there are too many knowledge points involved in documentation. So I can only say that the first wave of heights failed to become.
The sequence and function of the method call in this uiviewcontroller should be a good article, keep it first.
Oh, no. Still have to find time to read the official documents.
--------------------(I'm a split line)
iOS Learning--fifth day essays