UIImagePickerController an easy way to show library button in camera

I am trying to show the library button on the camera screen (UIImagePickerController). Here is my code:

- (void)takePhoto{ _imagePicker = [[UIImagePickerController alloc] init]; [_imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera]; [_imagePicker setDelegate:self]; _imagePicker.allowsEditing = YES; CGRect frame = self.view.frame; int y = frame.size.height; int x = frame.size.width; UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(x-100, y-50-1, 100, 30)]; [button setTitle:@"Library" forState:UIControlStateNormal]; [button setBackgroundColor:[UIColor clearColor]]; [button addTarget:self action:@selector(gotoLibrary:) forControlEvents:UIControlEventTouchUpInside]; [_imagePicker.view addSubview:button]; [self presentViewController:_imagePicker animated:NO completion:nil]; } -(IBAction)gotoLibrary:(id)sender { UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init]; [imagePicker.view setFrame:CGRectMake(0, 80, 450, 350)]; [imagePicker setSourceType:UIImagePickerControllerSourceTypeSavedPhotosAlbum]; imagePicker.allowsEditing = YES; [imagePicker setDelegate:self]; [_imagePicker presentViewController:imagePicker animated:YES completion:nil]; } 

The problem is the images when trying to take a picture. How to hide the library button when shooting? How it looks like

And problem as this

+6
source share
1 answer

A poor person, in order to solve this problem, would be to place the label on top, in the center, so he does not conflict with the photo button;)

Not the biggest fix, but its super fast

0
source

Source: https://habr.com/ru/post/958876/


All Articles