1、首先打开手机,设置在手机上的位置可能不同,然后在手机上面找到设置,进入设置。
2、找到设置之后往下拉,然后在设置的功能里面找到智能辅助,然后点击进入智能辅助。
3、找到时能辅助之后,然后在智能辅助里面找到导航栏,点击进入导航栏。
4、找到导航栏之后就会看到需要设置的三个键,好几种风格,选择喜欢的之后后面有一个小点,点击即可,然后返回到手机主界面。
5、返回到手机主界面之后,就可以看到我们设置好的三个键出来了。
//中间//self.navigationItem.title = @"标题"
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:@"个人信息"style:UIBarButtonItemStylePlaintarget:selfaction:@selector(goUserInfoVc:)]
UIBarButtonItem*rightItem2 = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemCameratarget:nilaction:nil]
self.navigationItem.rightBarButtonItems=@[rightItem,rightItem2]
//左边
UIBarButtonItem*leftItem = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemAddtarget:nilaction:nil]
//通过图片创建barButtonItem
//生成一张不受父视图tintColor影响的图片
UIImage*image = [[UIImageimageNamed:@"github_grayscale"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal]
UIBarButtonItem*leftItem2 = [[UIBarButtonItemalloc]initWithImage:imagestyle:UIBarButtonItemStylePlaintarget:nilaction:nil]
self.navigationItem.leftBarButtonItems=@[leftItem,leftItem2]
//设置导航栏
//self.navigationController.navigationBar.backgroundColor = [UIColor greenColor]
//设置导航栏的背景色
//self.navigationController.navigationBar.barTintColor = [UIColor greenColor]
//设置导航栏的样式
/*
UIBarStyleDefault浅
UIBarStyleBlack深
UIBarStyleBlackTranslucent
*/
self.navigationController.navigationBar.barStyle=UIBarStyleDefault
//设置背景图片不透明
//self.navigationController.navigationBar.translucent = NO
//修改导航左右内容的颜色
self.navigationController.navigationBar.tintColor= [UIColorgrayColor]
//隐藏自带的背景图片
[self.navigationController.navigationBarsetBackgroundImage:[[UIImagealloc]init]forBarMetrics:UIBarMetricsDefault]
//隐藏阴影图片
[self.navigationController.navigationBarsetShadowImage:[[UIImagealloc]init]]
//设置导航的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]
//创建木棍特效UIBarButtonItem样式Fixed
UIBarButtonItem*toolBarItem4 = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpacetarget:nilaction:nil]
toolBarItem4.width=50
UIBarButtonItem*toolBarItem5 = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFixedSpacetarget:nilaction:nil]
toolBarItem5.width=100
//创建d簧特效UIBarButtonItem样式Flexible
UIBarButtonItem*toolBarItem6 = [[UIBarButtonItemalloc]initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpacetarget:nilaction:nil]
//50棍- Play - 100棍- Stop -d簧- Edit - 50棍
self.toolbarItems=@[toolBarItem4,toolBarItem, toolBarItem5,toolBarItem2, toolBarItem6,toolBarItem3,toolBarItem4]
附加:
[self.navigationControllersetNavigationBarHidden:!self.navigationController.navigationBarHiddenanimated:YES]
[self.navigationControllersetToolbarHidden:!self.navigationController.toolbarHiddenanimated:YES]
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)