0

I need something like this status bar image but i am getting the status hidden but still i can not change the color. I am getting this status bar withour color

This is what i am doing.

-

(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];
}
backbencher
  • 99
  • 2
  • 8

3 Answers3

3

Use three steps:

1: Add UINavigationControllerDelegate, UIImagePickerControllerDelegate to your @interface yourController ()<>

2:

imagePickerController.delegate = self;

3:

-(void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];
}
Tamás Sengel
  • 55,884
  • 29
  • 169
  • 223
0

Try This:-

1.Create a view with height 20 points and change the background color to attach the viewcontrollerView (OR) change the background colour of your view controller follow like

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];
Ramesh_iOS
  • 11
  • 2
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];
}
backbencher
  • 99
  • 2
  • 8