ios--Navigation bar Style

Source: Internet
Author: User

Push Back button style:

Uibarbuttonitem *item = [[Uibarbuttonitem alloc] Initwithtitle:@ ""  Style:uibarbuttonitemstyleplain Target:nil Action:nil];     = item;     = [Uicolor graycolor];    [Self.navigationitem Sethidesbackbutton:yes];

Free Click event:

// User Agreement jump    UITapGestureRecognizer *labeltapgesturerecognizer = [[UITapGestureRecognizer alloc] initwithtarget:self action:@ Selector (Labelclick)];         // 2. Add the Click event to the label     [self. Userrate Addgesturerecognizer:labeltapgesturerecognizer];     // can be understood as setting the label can be clicked

Create left and right navigation bar buttons, search with personal center:

//create left and right navigation bar buttons, search and personal centerSelf.navigationItem.leftBarButtonItem = [[Uibarbuttonitem alloc] initwithimage:[self scaletosize:[uiimage imagenamed :@"Sousuo.png"] Size:cgsizemake ( -,19.6)] Style:uibarbuttonitemstyleplain target:self action: @selector (Actionleft:)]; Self.navigationItem.rightBarButtonItem= [[Uibarbuttonitem alloc] initwithimage:[self scaletosize:[uiimage imagenamed:@"Persons.png"] Size:cgsizemake ( -, -)] Style:uibarbuttonitemstyleplain target:self action: @selector (actionright:)];//Navigation bar Personal Information button-(void) Actionright: (ID) send{NSLog (@"Skip to the Personal center page"); Personalviewcontroller*personalview = [Self.storyboard instantiateviewcontrollerwithidentifier:@"Personalview"]; [Self.navigationcontroller Pushviewcontroller:personalview Animated:personalview];}//Navigation Bar Search button click event-(void) Actionleft: (ID) send{NSLog (@"jump to the search page"); Searchviewcontroller*search = [Self.storyboard instantiateviewcontrollerwithidentifier:@"Search"];    [Self.navigationcontroller Pushviewcontroller:search Animated:search]; }//Set Picture size-(UIImage *) Scaletosize: (UIImage *) img Size: (cgsize) size{//Create a bitmap context//and set it to the context that is currently being useduigraphicsbeginimagecontext (size); //draw a picture that changes size[img Drawinrect:cgrectmake (0,0, Size.width, Size.Height)]; //create a resized picture from the current contextuiimage* Scaledimage =Uigraphicsgetimagefromcurrentimagecontext (); //make the current context out of the stackUigraphicsendimagecontext (); //returns the new resized image    returnscaledimage;}

ios--Navigation bar Style

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.