Self.navigationItem.leftBarButtonItem = [[Uibarbuttonitem alloc]initwithtitle:@ ' side bar ' style: Uibarbuttonitemstyleplain target:self Action: @selector (Clickleftbutton:)];
If we use this line of code to define a button, regardless of the left-hand side, the picture or the text, he will change the font or picture color to the default blue, but not our needs,
So we do.
//navigation bar Double button//ImageUIImage *doublebuttonimage = [UIImage imagenamed:@"TX"]; //ButtonUIButton *doublebutton =[UIButton Buttonwithtype:uibuttontypecustom]; Doublebutton.bounds= CGRectMake (0,0, -, -); [Doublebutton setimage:doublebuttonimage Forstate:uicontrolstatenormal]; //button's Click event[Doublebutton addtarget:self Action: @selector (Doublebuttonclick) forcontrolevents:uicontroleventtouchupinside ]; //navigation bar ButtonsUibarbuttonitem *doublebuttonitem =[[Uibarbuttonitem Alloc]initwithcustomview:doublebutton]; //add to left of navigation barSelf.navigationItem.leftBarButtonItem = Doublebuttonitem;
The custom button as the navigation bar button, the focus is the red mark, we need to set the button type to custom instead of the system, so that our button picture color is the original color, if it is text, color can be set under their own, and will not be the default blue ~
Customize navigation bar Buttons