简体   繁体   English

iOS7 UIImagePickerController允许编辑无法正常工作

[英]iOS7 UIImagePickerController allowsEditing not working correctly

In someViewController: 在someViewController中:

UIImagePickerController* picker = [[UIImagePickerController alloc] init];
    picker.allowsEditing = YES;
    picker.sourceType = UIImagePickerControllerSourceTypeCamera;
    picker.delegate = self;

    [self presentViewController:picker animated:YES completion:^{

    }];

I take a photo and get to the next screen where (due to allowsEditing = YES; ) I have an option to crop my photo into square shape. 我拍了一张照片然后到了下一个屏幕(由于allowEditing = YES; )我可以选择将照片剪裁成方形。 White square rectangular appears on an initial position over the photo I've taken and I try to move it around. 白色方形矩形出现在我拍摄的照片上的初始位置,我尝试移动它。 I can drag it, but every time I release the finger, it goes back to the position it held initially. 我可以拖动它,但每次我松开手指,它都会回到它最初所持的位置。 The are no glitches. 没有毛刺。 When I release the finger, white framed rectangular animates with easeOut animation back to the position where I dragged it from. 当我松开手指时,白色框架矩形动画与easeOut动画回到我拖动它的位置。

It is not the same as if allowsEditing is set to NO. 它与allowEditing设置为NO不同。 If it is set to NO, than a cropping rectangle does not even appear. 如果设置为NO,则甚至不会出现裁剪矩形。

Previously, I thought that the problem appears only on iOS 7, but now I realise that it happens on all iOS versions. 以前,我认为问题只出现在iOS 7上,但现在我意识到它发生在所有iOS版本上。 I don't understand how this happened, but it started when I started using Xcode 5 and building for iOS7. 我不明白这是怎么发生的,但是当我开始使用Xcode 5并构建iOS7时就开始了。 I kept Xcode 4.6.3 on my Mac so I tried to build this app again with the older Xcode, but it did not fix anything. 我在我的Mac上保留了Xcode 4.6.3,所以我尝试用旧的Xcode再次构建这个应用程序,但它没有修复任何东西。

I also need to mention that when I load an image from photo library, cropping works fine, like it is supposed to. 我还需要提一下,当我从照片库加载图像时,裁剪工作正常,就像它应该的那样。 I have problems only when taking a new photo. 我拍摄新照片时遇到问题。

Furthermore, when initial crop rectangle appears, although I am unable to drag that rectangle around the photo, I can still zoom in and out. 此外,当出现初始裁剪矩形时,虽然我无法在照片周围拖动该矩形,但我仍然可以放大和缩小。 When I zoom in, I can then drag this (smaller) cropping rectangle around the photo but ONLY within boundaries of initial rectangle's position & size. 当我放大时,我可以在照片周围拖动这个(较小的)裁剪矩形,但只能在初始矩形的位置和大小的边界内。 If I cross that boundary, my cropping rectangle animates back to the inside of the invisible boundaries. 如果我越过那个边界,我的裁剪矩形会动画回到不可见边界的内部。

Anyone, please help... 有人,请帮忙......

It seems like this is a bug with UIImagePickerController. 看起来这是UIImagePickerController的一个错误。 I was trying to figure out what I did wrong. 我试图弄清楚我做错了什么。 But then I started a couple of blank new projects just to test this functionality. 但后来我开始了几个空白的新项目来测试这个功能。 I also checked out the Apple's official sample code: 我还查看了Apple的官方示例代码:

https://developer.apple.com/library/ios/samplecode/photopicker/Introduction/Intro.html https://developer.apple.com/library/ios/samplecode/photopicker/Introduction/Intro.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 UIImagePickerController 允许编辑不起作用 - UIImagePickerController AllowsEditing not working UIImagePickerController allowEditing = YES不起作用 - UIImagePickerController allowsEditing = YES not working ABPeoplePickerNavigationController和UIImagePickerController无法在ipad iOS7上正确显示 - ABPeoplePickerNavigationController and UIImagePickerController not displaying correctly on ipad iOS7 iOS - 如何使用allowEditing在UIImagePickerController中自定义crop rect? - iOS - How to customize the crop rect in UIImagePickerController with allowsEditing on? iOS7:隐藏和显示UIView无法正常工作 - iOS7: Hiding and showing of UIView not working correctly UIImagePickerController使用allowsEditing推送viewcontroller错误 - UIImagePickerController push viewcontroller bug with allowsEditing UIImagePickerController allowEditing = YES仅用于视频 - UIImagePickerController allowsEditing=YES just for video iOS7中带有取消按钮的弹出式窗口中的UIImagePickerController - UIImagePickerController within a popover with cancel button in iOS7 UIImagePickerController在allowEditing中隐藏正方形选择 - UIImagePickerController hide square selection in allowsEditing 将图像加载到本机UIImagePickerController允许编辑 - Loading Images into native UIImagePickerController allowsEditing
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM