UINavigationcontrollerBar,UIbarButtonItem按钮以及backButton背景及背景颜色改变
来源:互联网 发布:mac os app store 编辑:程序博客网 时间:2024/04/29 20:58
//改变navigationcontroller背景(青色)
[self.navigationController.navigationBar setBackgroundImage:imageforBarMetrics:UIBarMetricsDefault];
UIBarButtonItem *back = [[UIBarButtonItem alloc]initWithTitle:@"back"style:UIBarButtonItemStyleBorderedtarget:self action:@selector(back:)];
//backButton背景颜色(back按钮背景黄色)
back.tintColor = [UIColor yellowColor];
self.navigationItem.backBarButtonItem = back;
UIBarButtonItem *right = [[UIBarButtonItem alloc]initWithTitle:@"next" style:UIBarButtonItemStyleBordered target: self action:@selector(next:)];
//改变right背景颜色(next按钮背景绿色)
right.tintColor = [UIColor greenColor];
self.navigationItem.rightBarButtonItem = right;
// NSArray *fontsArr = [UIFont familyNames];//打印所有字体
//navigation标题(棕色brownColor)(字典依次为标题(餐饮,种类)字体颜色,阴影颜色,阴影范围,字体,字体大小)
[self.navigationController.navigationBarsetTitleTextAttributes:[NSDictionarydictionaryWithObjectsAndKeys:[UIColorbrownColor],UITextAttributeTextColor, [UIColorcolorWithRed:0 green:0blue:0alpha:0.8],UITextAttributeTextShadowColor,[NSValuevalueWithUIOffset:UIOffsetMake(0.5, 0.5)],UITextAttributeTextShadowOffset,[UIFontfontWithName:@"Times New Roman"size:24.0f],UITextAttributeFont,nil]];
//定制应用中所有导航栏有barButttonItem按钮 appearance(字典依次为标题(next,back)字体颜色,阴影颜色,阴影范围,字体,字体大小)
[[UIBarButtonItem appearance] setTitleTextAttributes:[NSDictionarydictionaryWithObjectsAndKeys:
[UIColor redColor ],UITextAttributeTextColor,[UIColorcolorWithRed:0green:0 blue:0alpha:0.8],UITextAttributeTextShadowColor,[NSValuevalueWithUIOffset:UIOffsetMake(1.5, 1.5)],UITextAttributeTextShadowOffset,[UIFontfontWithName:@"Times New Roman"size:20],UITextAttributeFont,nil]forState:UIControlStateNormal ];
有图有真相:(为了显示阴影效果偏移量UIOffsetMake(1.5, 1.5)比较,自己调小即可,红色为按钮标题颜色,黑色(alpha:0.8)为阴影)
- UINavigationcontrollerBar,UIbarButtonItem按钮以及backButton背景及背景颜色改变
- 改变按钮控件的背景及文本颜色
- PDF背景编辑之设置背景颜色以及改变背景
- js实现按钮改变背景颜色
- HTML-JavaScript--单击按钮改变背景颜色
- 按钮单击改变图片,布局单击改变背景颜色
- 改变UITableViewCell删除状态时,改变按钮的背景颜色。
- vc对话框添加图片背景及改变背景颜色
- vc对话框添加图片背景及改变背景颜色
- IOS UINavigationBar 背景及按钮颜色设置
- 改变对话框背景颜色
- 循环改变背景颜色
- Aptana3 改变背景颜色
- javaScript 改变背景颜色
- Cocos2d改变背景颜色
- mfc改变背景颜色
- 改变视图背景颜色
- Aptana3 改变背景颜色
- 点击单选按钮radio后面的文字即可选中单选按钮
- Javascript四舍五入(Math.round()与Math.pow())
- LeetCode Construct Binary Tree from Preorder and Inorder Traversal
- CKEDITOR多实例问题的解决(转)
- SIP消息路由
- UINavigationcontrollerBar,UIbarButtonItem按钮以及backButton背景及背景颜色改变
- boost log库 使用八
- linux下杀死进程(kill)的N种方法 包括python--killproc
- 深入理解connect by level<xxx
- zend studio 10 字体,颜色,快捷键等相关设置
- 使用Net-SNMP监控同一服务的不同应用
- canny 边缘检测
- 广州传智播客无法超越的.Net培训
- 最经典的Java课程就在广州传智播客