2016-11-09 11 views
0

나는 status bar image과 같은 것을 필요로하지만 상태가 숨겨지고 있지만 여전히 색을 바꿀 수는 없습니다. 나는 이것을 얻고있다 status bar withour colorimagepickercontroller 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]; 

(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

사용 세 단계 :

1 : @interface yourController()<>

2 UINavigationControllerDelegate, UIImagePickerControllerDelegate 추가 :

imagePickerController.delegate = self; 

3 :

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