码迷,mamicode.com
首页 > 其他好文 > 详细

UIImagePickerController导航字体颜色和背景

时间:2017-08-29 12:43:01      阅读:247      评论:0      收藏:0      [点我收藏+]

标签:let   image   view   anim   导航栏   建图   ext   tintcolor   文本   

创建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:18]} forState:UIControlStateNormal];
    
    [viewController.navigationItem.leftBarButtonItem setTitleTextAttributes:@{NSForegroundColorAttributeName:[UIColor whiteColor], NSFontAttributeName:[UIFont systemFontOfSize:18]} forState:UIControlStateNormal];
}

 

UIImagePickerController导航字体颜色和背景

标签:let   image   view   anim   导航栏   建图   ext   tintcolor   文本   

原文地址:http://www.cnblogs.com/Milo-CTO/p/7447108.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!