Navigationbar actually has three sub-views, Leftbarbuttonitem,rightbarbuttonitem, and Titleview. For the first two customizations, please refer to http://www.cnblogs.com/6duxz/p/4030916.html
The customization of Titleview is much simpler, as it can be seen as a view, replacing or adding a child view. Below I added two buttons to Titleview.
uibutton* Actionnewbutton = [[UIButton alloc]initwithframe:cgrectmake (0,0, -, +)]; [Actionnewbutton settitle:@"Test 1"Forstate:uicontrolstatenormal]; Actionnewbutton.tag=0; [Actionnewbutton settitlecolor:[uicolor colorwithred:0.1Green0.63Blue0.96Alpha0.93] Forstate:uicontrolstatenormal]; //Actionnewbutton.backgroundcolor=[uicolor Graycolor];UIButton* Classicaction = [[UIButton alloc]initwithframe:cgrectmake ( -,0, -, +)]; [Classicaction settitle:@"Test 2"Forstate:uicontrolstatenormal]; Classicaction.tag=1; [Classicaction Settitlecolor:[uicolor Blackcolor] forstate:uicontrolstatenormal]; //Classicaction.backgroundcolor=[uicolor Bluecolor];UIView* Titleview = [[UIView alloc]initwithframe:cgrectmake (0,0, -, +)]; //Titleview.backgroundcolor=[uicolor Redcolor];[Titleview Addsubview:actionnewbutton]; [Titleview addsubview:classicaction]; Self.navigationItem.titleView=titleview;
IOS8 Custom Navigationitem.titleview