#import "AppDelegate.h"
#import "FirstViewController.h"
#import "SecondViewController.h"
@interface Appdelegate ()
@end
@implementation Appdelegate
-(BOOL) Application: (UIApplication *) application didfinishlaunchingwithoptions: (nsdictionary *) launchOptions
{
Create a navigation bar view
Uinavigationcontroller *navc1=[[uinavigationcontroller Alloc] Initwithrootviewcontroller:[firstviewcontroller new] ];
Name of column
[Email protected] "message";
Prompt message
[Email protected] "2";
Add a picture
Navc1.tabbaritem.image=[uiimage imagenamed:@ "1"];
Uinavigationcontroller *navc2=[[uinavigationcontroller Alloc] Initwithrootviewcontroller:[secondviewcontroller New ]];
[Email protected] "dynamic";
[Email protected] "2";
Create columns
Uitabbarcontroller *tab=[[uitabbarcontroller alloc] init];
Add two navigation bars to the bottom view
[Email protected] [NAVC1,NAVC2];
Navc2.tabbaritem.image=[uiimage imagenamed:@ "2"];
Add foreground color
Tab.tabbar.tintcolor=[uicolor Greencolor];
Add the bottom view to the root view
Self.window.rootviewcontroller=tab;
return YES;
}
#import <UIKit/UIKit.h>
#import "SecondViewController.h"
@interface Firstviewcontroller:uiviewcontroller
@end
#import "FirstViewController.h"
@interface Firstviewcontroller ()
@end
@implementation Firstviewcontroller
-(void) viewdidload
{
[Super Viewdidload];
Replace background color
Self.view.backgroundcolor=[uicolor colorwithpatternimage:[uiimage imagenamed:@ "20141110_ F64c52ed5be2176adaa1madr4skv4nyu.jpg "];
Add title
[Email protected] "First view";
Change the foreground color of the title
[Email protected] {Nsforegroundcolorattributename:[uicolor Yellowcolor]};
Create a navigation bar button
Uibarbuttonitem *tab=[[uibarbuttonitem alloc] initwithtitle:@ "Next" Style:2 target:self action: @selector (next)];
Change the foreground color
Tab.tintcolor=[uicolor Redcolor];
Add Right button
Self.navigationitem.rightbarbuttonitem=tab;
}
-(void) Next
{
Secondviewcontroller *second=[[secondviewcontroller alloc] init];
Navigation bar View: Push to next page
[Self.navigationcontroller Pushviewcontroller:second Animated:yes];
}
#import "SecondViewController.h"
@interface Secondviewcontroller ()
@end
@implementation Secondviewcontroller
-(void) viewdidload
{
[Super Viewdidload];
Self.view.backgroundcolor=[uicolor colorwithpatternimage:[uiimage imagenamed:@ " 8efce6cd7b899e51feb2371b40a7d933c8950d83.jpg "];
[Email protected] "second view";
[Email protected] {Nsforegroundcolorattributename:[uicolor Greencolor]};
Uibarbuttonitem *tab=[[uibarbuttonitem alloc] initwithtitle:@ "Back" style:2 target:self action: @selector (BackPage)];
Self.navigationitem.leftbarbuttonitem=tab;
}
-(void) BackPage
{
Out of the stack to return to the previous page
[Self.navigationcontroller Popviewcontrolleranimated:yes];
}
Examples of Uinavigationcontroller and Uibarbuttonitem