EDIT : I am using UIStoryBoard
.
I have presented
like this:
UIImagePickerController *imagePicker = [[UIImagePi
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.
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:
[UIApplication sharedApplication].statusBarHidden = YES;
[self.navigationController presentViewController:imagePicker animated:YES completion:^{
}];
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// ... your code here
[UIApplication sharedApplication].statusBarHidden = NO;
[self dismissViewControllerAnimated:YES completion:^{
}];
}
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:
-(void)openPicker {}
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationSlide];
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
//configure image picker here
[self presentViewController:picker animated:YES completion:NULL];
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[NSTimer scheduledTimerWithTimeInterval:0.1 target:self selector:@selector(showStatusBar) userInfo:nil repeats:NO];
[picker dismissViewControllerAnimated:YES completion:NULL];
}
-(void)showStatusBar {
dispatch_async(dispatch_get_main_queue(), ^{
[[UIApplication sharedApplication] setStatusBarHidden:NO withAnimation:UIStatusBarAnimationSlide];
});
}
The reason was i was setting frame of view controller
which is in protrait mode
as its previous view
was in landscape mode
.
self.view.bounds = CGRectMake(0,0,...,...);
Whenever imagepicker
dissmiss
got called
it moved
to original position
as mentioned
.
Now changed in structure
for orientation
without setting self.view frame externally solved
my problem
.