将UIImagePicker导航栏样式更改为蓝色 [英] Change UIImagePicker Navigation Bar style to blue

查看:75
本文介绍了将UIImagePicker导航栏样式更改为蓝色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的所有视图都有一个蓝色导航栏,但是当我要用户选择照片时,UIImagePicker是黑色的.我试图使用UIBarStyleDefault将UIImagePickerController的导航栏设置为蓝色,但是它对我不起作用,颜色仍然是黑色.我也尝试过使用其他UIBarStyle,例如UIBarStyleBlack和UIBarStyleOpaque,但是无论如何它都不会更改选择器的导航栏.这是我的代码

All of my view has a blue navigation bar but when I want user to choose a photo, the UIImagePicker is black. I tried to set the navigation bar of UIImagePickerController to blue using UIBarStyleDefault but it does not work for me, the color is still black. I tried with other UIBarStyle like UIBarStyleBlack and UIBarStyleOpaque as well but it doesn't change the navigation bar of the picker anyway. Here is my code

    // Let the user choose a new photo.
    UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
    imagePicker.delegate = self;
    imagePicker.navigationBar.barStyle = UIBarStyleDefault;
    [self presentModalViewController:imagePicker animated:YES];
    [imagePicker release];

推荐答案

我认为无法更改它.因此,我的解决方案是使用色度计以颜色代码获取默认导航栏的颜色:红色代码,蓝色代码,绿色代码.然后我使用方法

I think there is no way to change it. So my solution is using Color Meter to get the color of the default navigation bar in color code: red code, blue code, green code. Then I use the method

imagePicker.navigationBar.tintColor = [UIColor colorWithRed:redCode绿色:greenCode蓝色:blueCode alpha:0.1];

imagePicker.navigationBar.tintColor = [UIColor colorWithRed:redCode green:greenCode blue:blueCode alpha:0.1];

UINavigationBar tintColor

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆