#import <UIKit/UIKit.h>@interface appdelegate:uiresponder <UIApplicationDelegate> *window; @end
#import "AppDelegate.h"#import "KeyViewController.h"@interfaceappdelegate ()@end@implementationappdelegate-(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]; //Initializing navigationUinavigationcontroller *navi =[[Uinavigationcontroller alloc] Initwithrootviewcontroller:[[keyviewcontroller alloc] init]; //set the background color of the navigation bar (after iOS7)[[Uinavigationbar appearance] Setbartintcolor:[[uicolor alloc] initwithred:133/255.0Green0Blue -/255.0Alpha1]]; //use a background image to set the color of the navigation bar (after iOS7)//[[Uinavigationbar appearance] setbackgroundimage:[uiimage imagenamed:@ "top bar Background"] Forbarmetrics: Uibarmetricsdefault]; //set the color of text on the navigation bar (after iOS7)[[Uinavigationbar appearance] Settitletextattributes:@{nsforegroundcolorattributename:[uicolor OrangeColor]}] ; Self.window.rootViewController=Navi; [Self.window makekeyandvisible]; returnYES;}@end
#import <UIKit/UIKit.h>@interface keyviewcontroller:uiviewcontroller@end
#import "KeyViewController.h"#import "CashViewController.h"@interfaceKeyviewcontroller ()@end@implementationKeyviewcontroller- (void) viewdidload {[Super viewdidload]; Self.title=@"Cash Withdrawal"; UIButton*GETCASHBTN =[UIButton Buttonwithtype:uibuttontypecustom]; Getcashbtn.frame= CGRectMake ( -, -, -, $); [Getcashbtn settitle:@"Next Page"Forstate:0]; Getcashbtn.backgroundcolor=[Uicolor Orangecolor]; [Getcashbtn addtarget:self Action: @selector (getcashaction:) forcontrolevents:uicontroleventtouchupinside]; [Self.view addsubview:getcashbtn];}- (void) Getcashaction: (UIButton *) sender{Cashviewcontroller*CASHVC =[[Cashviewcontroller alloc] init]; [Self.navigationcontroller PUSHVIEWCONTROLLER:CASHVC animated:yes];}- (void) didreceivememorywarning {[Super didreceivememorywarning]; //Dispose of any resources the can be recreated.}@end
#import <UIKit/UIKit.h>@interface cashviewcontroller:uiviewcontroller@end
#import "CashViewController.h"@interfaceCashviewcontroller ()@end@implementationCashviewcontroller- (void) viewdidload {[Super viewdidload]; Self.title=@"Bank card Bindings"; Self.view.backgroundColor=[Uicolor Whitecolor]; //use the picture to set the button to the left of the navigation bar//Uibarbuttonitem *leftitem = [[Uibarbuttonitem alloc] initwithimage:[uiimage imagenamed:@ "Back button"] Style:uibarbutton Itemstyleplain target:self Action: @selector (gobackaction:)]; //set the text of the left button on the navigation barUibarbuttonitem *leftitem = [[Uibarbuttonitem alloc] Initwithtitle:@"< back"Style:uibarbuttonitemstyleplain target:self Action: @selector (gobackaction:)]; //sets the color of the left button text in the navigation bar (and the color of the background image)Leftitem.tintcolor =[Uicolor Whitecolor]; Self.navigationItem.leftBarButtonItem=Leftitem;}/** * Click the event triggered by the left button on the navigation bar*/- (void) Gobackaction: (uibutton*) sender{[Self.navigationcontroller popviewcontrolleranimated:yes];}- (void) didreceivememorywarning {[Super didreceivememorywarning]; }@end
IOS Settings Navigation Bar II (set the navigation bar color, text color, the left button text and color)