UIImagePickerController导航字体颜色和背景
2024-10-19 06:19:15
创建UIImagePickerController
// 创建图片选择器
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType =UIImagePickerControllerSourceTypePhotoLibrary;
picker.allowsEditing = YES;
picker.delegate = self;
//设置导航栏背景颜色
picker.navigationBar.barTintColor = HexRGB(0x4294FE);
//设置右侧取消按钮的字体颜色
picker.navigationBar.tintColor = [UIColor whiteColor]; // 以富文本方式更改[picker.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont boldSystemFontOfSize:18]}];
[self presentViewController:picker animated:YES completion:nil];
右侧取消按钮的字体方式无效可使用代理方法
- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
[viewController.navigationItem.rightBarButtonItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:]} forState:UIControlStateNormal]; [viewController.navigationItem.leftBarButtonItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:]} forState:UIControlStateNormal];
}
最新文章
- ReactMix框架,让你实现一套js代码,基于ReactNative在H5,App都能完美跑起来,Write Once,Run Anywhere
- Crystal Reports ";Access to report file denied. Another program may be using it.";
- JavaWeb网页聊天室(WebSocket即时通讯)
- 用浏览器打开本地html 直接到首页 的解决方法
- 任E行M1端口比特率特征码
- 【转】The content of element type ";configuration"; must match ";(properties?,settings?,typeAliases?,typeHandlers?,objectFactory?...
- 【转载】详解java类的生命周期
- 转场动画2-Pop动画
- c#--foreach遍历的用法与split的用法
- C#使用FFmpeg 将视频格式转换成Gif图片示例
- Ubuntu 发行版的 Linux 操作系统
- S2_SQL_第四章
- 通过四个例子理解JavaScript拓展运算符
- 8Manage:数据安全,企业新时代的护航利器
- Git与SVN的区别(面试常问)
- jquery开发插件提供的几种方法
- 保持APP后台NSTimer运行
- java 循环读取文件夹里面的文件
- 《学习OpenCV(中文版)》
- Java serialVersionUID作用和生成