1. Set the navigation bar style
[Self. navigationbar setbackgroundimage: [uiimage imagenamed: @ "navibarbackground"] forbarmetrics: uibarmetricsdefault]; [self. navigationbar settintcolor: [uicolor whitecolor]; // baritem color nsshadow * shadow = [nsshadow new]; shadow. shadowcolor = [uicolor blackcolor]; shadow. shadowoffset = cgsizemake (3, 3); [self. navigationbar settitletextattributes: @ {identifier: [uicolor whitecolor], nsfontattributename: [uifont fontwithname: @ "americantypewriter" Size: 23], nsshadowattributename: Shadow}];
2.
Don't you want the title bar to be bald? You can replace it by using an image or sign in the code line: 1 self. navigationitem. titleview = [[uiimageview alloc] initwithimage: [uiimage imagenamed: @ "appcoda-logo.png"];
3. navigation bar inbound Animation
-(Ibaction) pushaction :( ID) sender {catransition * animation = [catransition animation]; [animation setduration: 1.3]; [animation settype: kcatransitionfade]; // fade in and out [animation setsubtype: kcatransitionfromleft]; [animation settimingfunction: [camediatimingfunction functionwithname: role]; secondviewcontroller * Second = [secondviewcontroller new]; [self. navigationcontroller pushviewcontroller: Second animated: No]; [self. navigationcontroller. view. layer addanimation: animation forkey: Nil];}
How to add an animation to the navigation bar by category
#import "UINavigationController+CustomPushOrPop.h"@implementation UINavigationController (CustomPushOrPop)-(void)customPushViewContrller:(UIViewController *)viewContrller{ viewContrller.view.frame = CGRectMake(0,-viewContrller.view.frame.size.height, self.view.frame.size.width, self.view.frame.size.height); [self pushViewController:viewContrller animated:NO]; [UIView animateWithDuration:0.35f animations:^ { viewContrller.view.frame = CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height); } completion:^(BOOL finished) { }];}
.