2016-11-09 11 views
0

私はこのようなものが必要ですstatus bar imageしかし、私は状態を隠していますが、まだ私は色を変更することはできません。私はこれを得ていますstatus bar withour colorimagepickercontrollerのステータスバーの色を変更する方法は?

これは私がやっていることです。

-

(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]; 

(OR)

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

使用する3つのステップ:

1:あなたの@interface yourController()<>

2にUINavigationControllerDelegateUIImagePickerControllerDelegateを追加します。

imagePickerController.delegate = self; 

3:

-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated 
{ 
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent]; 
} 
関連する問題