iPhone camera controls are misaligned - ios

For some reason my camera controls are misaligned and are displaying cut off at the top of the screen. Below is the code that I've implemented to use the camera, is there anything that could fix this?
- (void)takePhoto {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
if ([UIImagePickerController isSourceTypeAvailable: UIImagePickerControllerSourceTypeCamera]) {
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.cameraCaptureMode = UIImagePickerControllerCameraCaptureModePhoto;
} else {
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
}
[MAINVIEWCONTROLLER presentViewController:picker animated:YES completion:nil];
}

check wantsFullScreenLayout and set it accordingly.
If you want full screen, you will also need to hide the status bar using setStatusBarHidden:withAnimation:

Related

full screen camera in ios

I'm using the following code so the user can take a pic:
- (IBAction)takePhoto:(UIButton *)sender {
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:YES completion:NULL];
}
Is there a way to make the camera occupy the hole screen?
What you're seeing is the default implementation of UIImagePickerController which includes camera controls.
Try turning these off by setting showsCameraControls to NO.
If you want to add your own controls, use cameraOverlayView.

UIImagePickerController doesn't display rotate button

It's an iPhone app running in iPad in iOS7. In iPhone it works fine.
However in iPad, the rotate button is not displayed and the view is like cut off on the top.
I'm not doing anything strange with the image picker. Here's how I show it:
- (void)showImagePickerWithSourceType:(UIImagePickerControllerSourceType)sourceType
{
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.mediaTypes = #[(NSString*)kUTTypeImage];
imagePicker.sourceType = sourceType;
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
//Select front facing camera if available
if (sourceType == UIImagePickerControllerSourceTypeCamera && [UIImagePickerController isCameraDeviceAvailable:UIImagePickerControllerCameraDeviceFront])
{
imagePicker.cameraDevice = UIImagePickerControllerCameraDeviceFront;
}
[self presentViewController:imagePicker animated:YES completion:nil];
}

iOS UIImagePickerController has white squares instead of icons

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?

UIPickerController iPad capture cropping size

I used a very popular code to capture photo with iPad
-(void)presentImagePicker:(UIImagePickerControllerSourceType)source sender:(UIButton *)sender
{
if (!self.popOver && [UIImagePickerController isSourceTypeAvailable:source])
{
NSArray *availableMedia = [UIImagePickerController availableMediaTypesForSourceType:source];
if ([availableMedia containsObject:(NSString*)kUTTypeImage])
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.sourceType = source;
picker.mediaTypes = #[(NSString*)kUTTypeImage];
picker.allowsEditing = YES;
if (source != UIImagePickerControllerSourceTypeCamera &&
UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
self.popOver = [[UIPopoverController alloc] initWithContentViewController:picker];
[self.popOver presentPopoverFromRect:sender.bounds
inView:sender
permittedArrowDirections:UIPopoverArrowDirectionAny
animated:YES];
self.popOver.delegate = self;
}
else
{
[self presentViewController:picker animated:YES completion:nil];
}
}
}
}
The problem is that when the picker shows up, the cropping-size of the capture image is different from the size of the iPad (full screen). It is like a box centered in the screen.
When I take the picture in portrait mode, the captured image is not the portrait image, but something different in size.
My application can run only in landscape mode: is that the problem?
The solution is here
GKImage picker
a custom picker, very very useful.

Using GKImagePicker to crop photo

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.

Resources