Thumbnails do not display in the UIImagePickerController when running on iPhone 11 or real device with iOS 14.
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate=self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self presentViewController:picker animated:YES completion:nil];
Result:
Photos and Albums showing as Blank but when I tap on-screen image will be selected.
For me, it was caused by using
UIScrollView.appearance(whenContainedInInstancesOf: [UINavigationController.self]).backgroundColor = .backgroundPrimaryNew
I don't know why is that, but after I've removed this line it began working again and thumbnails are showing.
Try this
Instead of presenting add UIImagePickerController as subView
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate=self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
[self.view addSubview:self.picker.view];
[self addChildViewController:self.picker];
[self.picker didMoveToParentViewController:self];
Related
This is my code to present the UIImagePickerController:
UIImagePickerController *imagepicker = [[UIImagePickerController alloc] init];
imagepicker.delegate = self;
imagepicker.view.backgroundColor = [UIColor orangeColor];
UIImagePickerControllerSourceType sourcheType = UIImagePickerControllerSourceTypePhotoLibrary;
imagepicker.sourceType = sourcheType;
imagepicker.allowsEditing = YES;
[self presentViewController:imagepicker animated:YES completion:nil];
This is the image where the error occurred
This is a normal picture
This happens on one iPad (iOS 11.1.2), but it works fine on the other (iOS 8.4.1). I tried the changes, but none seemed to work.
I am using UIImagepickerController to capture video in my app.
Sometimes it behaves strangely - that image capturing is coming. Mostly it comes when a new user is registered and try to capture a video or a new ipa file is installed and tested. Eventhough it appears randomly.
When I prompt UIImagepickerController it display take photo button (White button) instead of video record button (Red button)
Here is my code -
UIImagePickerController *imagePicker=[[UIImagePickerController alloc]init];
imagePicker.delegate=self;
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
imagePicker.allowsEditing = YES;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.mediaTypes = [[NSArray alloc] initWithObjects: (NSString *) kUTTypeMovie, nil];
}
[self presentViewController:imagePicker animated:YES completion:NULL];
Just try replacing your code with this.
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
// picker.mediaTypes = [NSArray arrayWithObject:(NSString *)kUTTypeMoviekUTTypeImage];
picker.mediaTypes = [NSArray arrayWithObjects:(NSString *)kUTTypeMovie,nil];
//picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModeVideo;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:YES completion:NULL];
I am using the camera for my app but when i start it, the camera shows up like in the image below.
This is the code I use to start the camera app:
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:YES completion:NULL];
Why are the camera icons all white?
I want to crop a photo that is taken in the app and then save. I am using the GKImagePicker so that I can do this but if I use the code below even though I push the take photo button in my app it shows me the photo library which I pick to crop. I do not want to do this and just want to crop my photo which I have taken in the app.
- (IBAction)takePhoto:(UIButton *)sender {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
self.imagePicker = [[GKImagePicker alloc] init];
self.imagePicker.cropSize = CGSizeMake(320, 320);
self.imagePicker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentModalViewController:self.imagePicker.imagePickerController animated:YES];
[self presentViewController:picker animated:YES completion:NULL];
}
Remove the last line in your code:
[self presentViewController:picker animated:YES completion:NULL];// remove
and give it a try ;)
You can also check this.
I am facing a problem when I try to access the photo library when developing iPad apps. However, the same code works properly for iPhone dev. The error which is generated is:
On iPad, UIImagePickerController must be presented via UIPopoverController
I am using the following code for iPad development:
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:picker animated:YES];
[picker release];
}
Try presenting with a pop over controller in iPad, doesn't support modal view controller
even I encountered the same problem, so tried using pop over controller and it works now :)
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
popControl = [[UIPopoverController alloc]initWithContentViewController:picker];
popControl.delegate=self;
[popControl presentPopoverFromRect:browseButton.bounds inView:mainView permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];