Appdelegate.m
appdelegate.m//task5////Created by Lyb on 14-9-27.//Copyright (c) 2014 imac. All rights reserved.//#import "AppDelegate.h" #import "FirstViewController.h" #import "SecondViewController.h" @ Implementation appdelegate-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: ( Nsdictionary *) launchoptions{Self.window = [[UIWindow alloc] initwithframe:[[uiscreen mainscreen] bounds]]; Override point for customization after application launch. Self.window.backgroundColor = [Uicolor Whitecolor]; [Self.window makekeyandvisible]; Firstviewcontroller *firstctrl = [[Firstviewcontroller alloc] init]; Secondviewcontroller *secondctrl =[[secondviewcontroller alloc] init]; Uinavigationcontroller *NAVCTRL1 = [[Uinavigationcontroller alloc] Initwithrootviewcontroller:firstctrl]; Uinavigationcontroller *NAVCTRL2 = [[Uinavigationcontroller alloc] Initwithrootviewcontroller:secondctrl]; Uitabbarcontroller *tabbarctrl = [[UitabbarcontRoller alloc] init]; Tabbarctrl.viewcontrollers = @[navctrl1, navCtrl2]; Self.window.rootViewController = Tabbarctrl; return YES;} @end
Firstviewcontroller.m
-(void) viewdidload{ [Super Viewdidload]; Self.title = @ "left"; Self.view.backgroundColor = [Uicolor redcolor];}
Secondviewcontroller.m
#import "SecondViewController.h" #import "ThirdViewController.h" @interface Secondviewcontroller () @ End@implementation secondviewcontroller-(ID) initwithnibname: (NSString *) Nibnameornil Bundle: (NSBundle *) nibbundleornil{self = [super Initwithnibname:nibnameornil Bundle:nibbundleornil]; if (self) { self.title = @ "right"; } return self;} -(void) viewdidload{ [Super Viewdidload]; Self.view.backgroundColor = [Uicolor greencolor]; UIButton *button = [UIButton buttonwithtype:uibuttontypecontactadd]; Button.frame = CGRectMake (All-in-all; [Button addtarget:self action: @selector (Buttonaction) forcontrolevents:uicontroleventtouchupinside]; [Self.view Addsubview:button];} -(void) buttonaction{ thirdviewcontroller *thirdctrl = [[Thirdviewcontroller alloc] init]; [Self.navigationcontroller Pushviewcontroller:thirdctrl animated:yes];}
Thirdviewcontroller.m
-(ID) Initwithnibname: (NSString *) Nibnameornil Bundle: (NSBundle *) nibbundleornil{self = [Super Initwithnibname: Nibnameornil Bundle:nibbundleornil]; if (self) { //Hides tab bar toolbar self.hidesbottombarwhenpushed = YES; } return self;} -(void) viewdidload{ [Super Viewdidload]; Self.view.backgroundColor = [Uicolor orangecolor]; Self.title = @ "three"; }
Mobile QQ bottom section bar effect "tab bar"