我的图像选择器视图控制器设置在弹出控制器内.在iOS 6上,一切都运行良好,但在iOS 7上,图像旋转,所有移动都在做:当转动iPad时,左图像向下移动,向上移动图像向左移动等.
这是显示我的相机的代码:
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
objPopView = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[objPopView presentPopoverFromRect:CGRectMake(842, 163, 0, 0)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionRight
animated:YES];
Run Code Online (Sandbox Code Playgroud)
我的应用仅使用横向模式,现在图像被旋转:

我正在使用Ios6中的iPad应用程序,当我们点击右边的按钮时,我正在执行如下操作:
-(IBAction)camerabuttonAction:(id)sender
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.delegate = self;
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:picker];
[self.popoverController presentPopoverFromRect:CGRectMake(50, -250, 500, 300) inView:appDelegate.splitview.view permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];
}
Run Code Online (Sandbox Code Playgroud)
我的问题是,当我在Land scape模式时,如果我点击按钮.每次使用后,相机将以纵向模式显示(图像以反向模式显示).但是,如果我摇动iPad,它会在LandScape中显示,即正确的方向.
见下图
当我处于Land scape模式时,如果我点击按钮,相机会显示如下图像:

如果我摇动iPad,那么相机会显示如下图像:

我已经尝试了很多并用Google搜索,但我找不到任何解决方案.这是在节省我的时间,所以如果有人工作,请指导我并发布示例代码.
我必须UIImagePickerController从照片库中选择/挑选图像。我已经允许 UIImagePickerController 编辑(选定的)图像(图像的裁剪方框),这在 iPhone 上运行良好,但 iPad 无法提供正确编辑(裁剪)的图像。
我尝试了以下建议但找不到解决方案:
iPad iOS7 - UIPopoverController 中的 UIImagePickerController has wrong preview image
这是我尝试过的代码:
let imagePicker = UIImagePickerController()
imagePicker.allowsEditing = true
// Update (zoom) visibility of image using pinch gesture & retrieve image using delegate - didFinishPickingMediaWithInfo
//------------------------------------------
func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) {
if let pickedImage = info[UIImagePickerControllerEditedImage] as? UIImage {
// Wrong image - retrieves image different than actual visible in the editing window of picker view. …Run Code Online (Sandbox Code Playgroud)