2016-11-09 6 views
0

Мне нужно что-то вроде этого status bar image, но я получаю статус скрытый, но все же я не могу изменить цвет. Я получаю это status bar withour colorКак изменить цвет строки состояния imagepickercontroller ios?

Это то, что я делаю.

-

(void)showGallery 
    UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
    picker.delegate = self; 
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
    picker.allowsEditing = NO; 
// picker.navigationBarHidden = YES; 
// picker.toolbarHidden = YES; 
    picker.navigationController.navigationBar.barTintColor=[UIColor orangeColor]; 
    picker.navigationBar.backgroundColor = [UIColor orangeColor]; 
    picker.navigationBar.barStyle=UIBarStyleBlack; 
    [ picker.navigationBar setTitleTextAttributes:@{NSForegroundColorAttributeName: [UIColor whiteColor]}]; 

    [self presentViewController:picker animated:YES completion:NULL]; 
} 

ответ

0

Try This:-

1.Create вид с высоты 20 точек и изменить цвет фона, чтобы прикрепить viewcontrollerView (OR) изменить цвет фона вашего контроллера представления следовать как

UIView*statusbarview = [[UIView alloc] initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, 20)]; 
statusbarview.backgroundColor = [UIColor greenColor]; 
[self.view addSubview:statusbarview]; 

(ИЛИ)

self.view.backgroundColor = [UIColor redColor]; 
0
This solved my problem. 

-(void)showGallery 
{ 
    UIImagePickerController *picker = [[UIImagePickerController alloc] init]; 
    picker.delegate = self; 
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; 
    picker.allowsEditing = NO; 
    picker.modalPresentationStyle = UIModalPresentationFullScreen; 
    picker.navigationBar.translucent = NO; 
    picker.navigationBar.barTintColor = [UIColor orangeColor]; 
    picker.navigationBar.tintColor = [UIColor whiteColor]; 
    picker.navigationBar.titleTextAttributes = @{NSForegroundColorAttributeName: [UIColor whiteColor]}; 
    [self presentViewController:picker animated:YES completion:nil]; 
} 
2

Используйте три шага:

1: Добавить UINavigationControllerDelegate, UIImagePickerControllerDelegate вашему @interface yourController()<>

2:

imagePickerController.delegate = self; 

3:

-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated 
{ 
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 
}