1. View Controller individual method call timing
2. tab (tab bar) and navigation bar (Navigation bar)
View Controller individual method call timing
Init: Method
Instantiate the necessary objects in the Init method (following the Lazyload thought) Init method initializes the Viewcontroller itself Loadview: Method This is when the nib View page is not being used, and the subclass will create its own custom view layer. You must not call Viewdidload directly: The method is called after the view is loaded viewwillappear: Call Viewdidappear When the method view is about to be visible: Method video calls Viewwilldisappear when it transitions completely to the screen: Method view is dismissed when called, overwritten or otherwise hidden viewdiddisappear: Method View is dismissed after calling, overwriting or otherwise hidingwhen a view is switched to B view, the sequential processViewdidload of the 1.B viewViewwilldisappear of the 2.A viewViewwillappear of the 3.B view4.A View Viewdiddisappear5.B View Viewdidappear tabs (tab bar) and navigation bar (Navigation bar)
AppDelegate.h file
#import <UIKit/UIKit.h>
@interface Appdelegate:uiresponder <UIApplicationDelegate>
@property (Strong, nonatomic) UIWindow *window;
@property (strong,nonatomic) uitabbarcontroller *tabbarcontroller;//Bottom Tab Controller
@end
APPDELEGATE.M file
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (Nsdictionary *) launchOptions {
Self.window=[[uiwindow Alloc]initwithframe:[[uiscreen Mainscreen] bounds];
Message Controller
Messageviewcontroller *msgcontroller=[[messageviewcontroller alloc] init];
Uinavigationcontroller *navmsg=[[uinavigationcontroller alloc] Initwithrootviewcontroller:msgcontroller];
The picture style of the//tab is handled this way to prevent the picture from being completely displayed
Uitabbaritem *msgtabitem = [[Uitabbaritem alloc]initwithtitle:@ ' message ' image:[[uiimage imagenamed:@ ' [email protected] ' Imagewithrenderingmode:uiimagerenderingmodealwaysoriginal] selectedimage:[[uiimage imageNamed:@ "[email protected] [] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]];
Navmsg.tabbaritem=msgtabitem;
Contact Controller
Contactviewcontroller *concontroller=[[contactviewcontroller alloc] init];
Uinavigationcontroller *navcon=[[uinavigationcontroller alloc] Initwithrootviewcontroller:concontroller];
Uitabbaritem *contabitem = [[Uitabbaritem alloc]initwithtitle:@ ' contacts ' image:[[uiimage imagenamed:@ ' tab_ [email Protected] "imagewithrenderingmode:uiimagerenderingmodealwaysoriginal] selectedimage:[[uiimage imageNamed:@" tab_ [email protected] [] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal]];
Navcon.tabbaritem=contabitem;
Dynamic Controller
Dynamicviewcontroller *dyncontroller=[[dynamicviewcontroller alloc] init];
Uinavigationcontroller *navdyn=[[uinavigationcontroller alloc] Initwithrootviewcontroller:dyncontroller];
Uitabbaritem *dyntabitem = [[Uitabbaritem alloc]initwithtitle:@ "dynamic" Image:[[uiimage imagenamed:@ "tab_ [email protected ] "] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal] selectedimage:[[uiimage imageNamed:@" tab_ [email protected] [] imagewithrenderingmode:uiimagerenderingmodealwaysoriginal];
Navdyn.tabbaritem=dyntabitem;
Self.tabbarcontroller=[[uitabbarcontroller alloc] init];
[Email protected] [Navmsg,navcon,navdyn];
self.tabbarcontroller.selectedindex=0;
Since the iphone is a single-window program, there is only such a Windows object, and it is UIWindow, not nswindow. And according to the document: This is a convenient way to make the main window of the object being used appear to the front of the screen.
[Self.window makekeyandvisible];
return YES;
}
IOS, view controller related (Uiviewcontroller)