Custom navigation bar

Source: Internet
Author: User

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)    {            }];}

.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.