Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Background shows when appear UIImagePickerController

I used this code to choose an image from the library:

UIImagePickerController *imagePicker = [[UIImagePickerController alloc]init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.allowsEditing = YES;
imagePicker.delegate = self;
[self presentViewController:imagePicker animated:YES completion:^{viewLoadPhotoBg.hidden = YES;}];

I also use the left menu library in my project. When the UIImagePickerController appears, the left menu shows in background. I guess UIImagePickerController background color is clear and based on my search, some answers say there is no way to change the background color.

What should I do not to see the background when displaying a UIImagePickerController?

Here is the screenshot. I covered my left menu to hide some sensitive information.

enter image description here

like image 692
Le'Kirdok Avatar asked Dec 05 '25 07:12

Le'Kirdok


1 Answers

I found the solution, it is really easy. I couldn't figure out yesterday. Here is the answer;

imagePicker.view.backgroundColor = [UIColor whiteColor];
imagePicker.view.alpha = 1.0;
like image 74
Le'Kirdok Avatar answered Dec 07 '25 22:12

Le'Kirdok



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!