//中間
//self.navigationItem.title = @"標(biāo)題";
UIView*redView = [[UIViewalloc]initWithFrame:CGRectMake(0,0,140,40)];
redView.backgroundColor= [UIColorredColor];
UIView*greenView = [[UIViewalloc]initWithFrame:CGRectMake(20,5,100,30)];
greenView.backgroundColor= [UIColorgreenColor];
[redViewaddSubview:greenView];
self.navigationItem.titleView= redView;
//右邊
UIBarButtonItem*rightItem = [[UIBarButtonItemalloc]initWithTitle:@"個(gè)人信息"style:UIBarButtonItemStylePlaintarget:selfaction:@selector(goUserInfoVc:)];
UIBarButtonItem*rightItem2 = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCameratarget:nilaction:nil];
self.navigationItem.rightBarButtonItems=@[rightItem,rightItem2];
//左邊
UIBarButtonItem*leftItem = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAddtarget:nilaction:nil];
//通過圖片創(chuàng)建barButtonItem
//生成一張不受父視圖tintColor影響的圖片
UIImage*image = [[UIImageimageNamed:@"github_grayscale"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
UIBarButtonItem*leftItem2 = [[UIBarButtonItemalloc]initWithImage:imagestyle:UIBarButtonItemStylePlaintarget:nilaction:nil];
self.navigationItem.leftBarButtonItems=@[leftItem,leftItem2];
//設(shè)置導(dǎo)航欄
//self.navigationController.navigationBar.backgroundColor = [UIColor greenColor];
//設(shè)置導(dǎo)航欄的背景色
//self.navigationController.navigationBar.barTintColor = [UIColor greenColor];
//設(shè)置導(dǎo)航欄的樣式
/*
UIBarStyleDefault淺
UIBarStyleBlack深
UIBarStyleBlackTranslucent
*/
self.navigationController.navigationBar.barStyle=UIBarStyleDefault;
//設(shè)置背景圖片不透明
//self.navigationController.navigationBar.translucent = NO;
//修改導(dǎo)航左右內(nèi)容的顏色
self.navigationController.navigationBar.tintColor= [UIColorgrayColor];
//隱藏自帶的背景圖片
[self.navigationController.navigationBarsetBackgroundImage:[[UIImagealloc]init]forBarMetrics:UIBarMetricsDefault];
//隱藏陰影圖片
[self.navigationController.navigationBarsetShadowImage:[[UIImagealloc]init]];
//設(shè)置導(dǎo)航的toolBar
//把toolBar顯示出來
self.navigationController.toolbarHidden=NO;
UIBarButtonItem*toolBarItem = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemPlaytarget:nilaction:nil];
UIBarButtonItem*toolBarItem2 = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemStoptarget:nilaction:nil];
UIBarButtonItem*toolBarItem3 = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemEdittarget:nilaction:nil];
//創(chuàng)建木棍特效UIBarButtonItem樣式Fixed
UIBarButtonItem*toolBarItem4 = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpacetarget:nilaction:nil];
toolBarItem4.width=50;
UIBarButtonItem*toolBarItem5 = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpacetarget:nilaction:nil];
toolBarItem5.width=100;
//創(chuàng)建彈簧特效UIBarButtonItem樣式Flexible
UIBarButtonItem*toolBarItem6 = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpacetarget:nilaction:nil];
//50棍- Play - 100棍- Stop -彈簧- Edit - 50棍
self.toolbarItems=@[toolBarItem4,toolBarItem, toolBarItem5,toolBarItem2, toolBarItem6,toolBarItem3,toolBarItem4];
附加:?
[self.navigationControllersetNavigationBarHidden:!self.navigationController.navigationBarHiddenanimated:YES];
[self.navigationControllersetToolbarHidden:!self.navigationController.toolbarHiddenanimated:YES];