How to hide status bar in UIImagepickercontroller?

前端 未结 13 1864
眼角桃花
眼角桃花 2020-11-30 02:55

I am new to iOS development. I am trying to hide status bar in UIImagePickerController. Whenever I click on \"Take photo\", status bar appears. It doesn\'t hide

相关标签:
13条回答
  • 2020-11-30 03:57
    -(IBAction)takePhoto:(UIButton *)sender
    {
        UIImagePickerController *picker = [[UIImagePickerController alloc] init];
        picker.delegate = self;
        picker.allowsEditing = YES;
        picker.sourceType = UIImagePickerControllerSourceTypeCamera;
        [self statusBar:TRUE];
        [self presentViewController:picker animated:YES completion:NULL];
    }
    
    
    -(void)imagePickerController:(UIImagePickerController *)picker      didFinishPickingMediaWithInfo:(NSDictionary *)info
    {        
        UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
        self.imageView.image = chosenImage;
        [self statusBar:FALSE];
        [picker dismissViewControllerAnimated:YES completion:NULL];
    }
    
    
    -(void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
    {
        [self statusBar:FALSE];
        [picker dismissViewControllerAnimated:YES completion:NULL];
    }
    
    
    -(void)statusBar:(BOOL)status
    {
        [[UIApplication sharedApplication] setStatusBarHidden:status];
    }
    

    that might help you to achieve what you want.

    0 讨论(0)
提交回复
热议问题