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