0

How to hide "Status Bar" when appear UIImagepickerController?

Here i using iOS coding and xcode 5.

  1. In a view has two buttons one for camera and another gallery. this view would be showed status bar always.
  2. When user press camera button then will appear camera. but it is showed status bar. After take photo will disappear to view.

I would be like hide "Status Bar" when appear Camera. Is there any code?

Tulon
  • 4,011
  • 6
  • 36
  • 56
Taj rajan
  • 601
  • 1
  • 6
  • 20
  • Please see this having same problem http://stackoverflow.com/questions/18760710/how-to-hide-status-bar-in-uiimagepickercontroller – IQworld Master May 12 '14 at 09:21

5 Answers5

1
**Try this Code :-**

- (void)viewWillAppear:(BOOL)animated
{
    [[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationNone];
}

- (void)viewWillDisappear:(BOOL)animated
{
    [[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationNone];
}

//iOS 7 into set this property in info.plist file.

  1. set Status bar is initially hidden = YES
  2. add row: View controller-based status bar appearance = NO

enter image description here

Renish Dadhaniya
  • 10,642
  • 2
  • 31
  • 56
1

Please try this one :

First set in your .plist file.

'View controller-based status bar appearance' and set to NO.

enter image description here

Add in your AppDelegate Method

[application setStatusBarHidden:NO]; 
[application setStatusBarStyle:UIStatusBarStyleDefault]; 

If you want to change statsubar color change the setStatusBarStyle according to your app background color.

Also you can try:

- (void)navigationController:(UINavigationController *)navigationController willShowViewController:(UIViewController *)viewController animated:(BOOL)animated
{
    [[UIApplication sharedApplication] setStatusBarHidden:YES];
}
Soumya Ranjan
  • 4,817
  • 2
  • 26
  • 51
0

Solution

Go to your plist file and add a new row, View Controller-Based Status Bar Appearance

This should handle this problem.

Community
  • 1
  • 1
E-Riddie
  • 14,660
  • 7
  • 52
  • 74
0

put this line in your camera button method

[[UIApplication sharedApplication] setStatusBarHidden:YES animated:NO];  
Gajendra Rawat
  • 3,673
  • 2
  • 19
  • 36
0

you add this code

- (void)navigationController:(UINavigationController *)navigationController
      willShowViewController:(UIViewController *)viewController
                    animated:(BOOL)animated {

   if(IS_IOS_7){
      if ([navigationController isKindOfClass:[UIImagePickerController class]] &&
          ((UIImagePickerController *)navigationController).sourceType == UIImagePickerControllerSourceTypeSavedPhotosAlbum) {
         [[UIApplication sharedApplication] setStatusBarHidden:YES];
         [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleLightContent];

      }
   }
}
Banker Mittal
  • 1,918
  • 14
  • 26