EDIT : I am using UIStoryBoard
.
I have presented
like this:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; //| UIImagePickerControllerSourceTypeSavedPhotosAlbum ;
imagePicker.mediaTypes = [NSArray arrayWithObjects:(NSString *) kUTTypeImage,nil];
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary])
{
if ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone)
{
imagePicker.allowsEditing = YES;
[self.navigationController presentViewController:imagePicker animated:YES completion:^{
}];
}
}
Now when dissmissed
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
UIImage *image = info[UIImagePickerControllerEditedImage];
NSLog(@"Image : %@",image);
[self dismissViewControllerAnimated:YES completion:^{
}];
}
Now view
becomes like this as shown in fiqure
:
EDIT : view gets pushed up to 20px when dissmissed.
EDIT : This is only in iOS 6.0 only
I had similar issue on iOS 8.2. After picking video using UIImagePickerController the frame is increased by 20px, top area of view controller is looking good, but the bottom is cut off. The solution is:
If that blue part of view is custom
UIView
then you should check the auto resizing mask for that view. You will find the problem.The reason was i was setting frame of
view controller
which is inprotrait mode
as itsprevious view
was inlandscape mode
.Whenever
imagepicker
dissmiss
gotcalled
itmoved
tooriginal position
asmentioned
.Now changed in
structure
fororientation
without setting self.view frame externallysolved
myproblem
.I have similar problem, and in my case 20 pixels was the status bar height. So, try to set status bar visibility to NO before showing imagePicker and YES when it finished (in delegate methods).
something like this: