I try to use UIImagePickerController to pick photo from iphone galery. On button click I do the following:
- (IBAction)attachAction:(id)sender {
self.imagePicker = [[UIImagePickerController alloc] init];
self.imagePicker.delegate = self;
self.imagePicker.allowsEditing = YES;
self.imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentModalViewController:self.imagePicker animated:YES];
}
In portrait it's fine, but when I rotate to landscape, present image picker and after doing some work dismiss it, layout of parent view controller breaks and I see half of screen with parent view and other half - black rectangle.
Any ideas how to solve this? How to force uiviewcontroller to change layout or its orientation manually after imagePicker dismissed?
I try to handle rotation by this code, but nothing changes situation
- (NSUInteger)supportedInterfaceOrientations {
return UIInterfaceOrientationMaskPortrait;
}
- (BOOL)shouldAutorotate
{
return YES;
}
-(void) willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
[self.view setNeedsLayout];
}