我有一个 UIImagePicker,它非常适合一种 UIImagePickerControllerSourceTypePhotoLibrary,但是当我使用 UIImagePickerControllerSourceTypeCamera 时,编辑框无法从图像的中心移动。因此,如果图片的高度大于宽度,则用户无法将编辑框移动到图片的顶部正方形。
有人知道为什么会这样吗?只有当源来自相机而不是库时才会发生这种情况。
编辑:一些代码!!!
if (actionSheet.tag == 2) {
if (buttonIndex == 0) { // Camera
// Check for camera
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] == YES) {
// Create image picker controller
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
// Set source to the camera
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePicker.allowsEditing = YES;
// Delegate is self
imagePicker.delegate = self;
// Show image picker
[self presentViewController:imagePicker
animated:YES
completion:^(void) {
}];
}
}
else if (buttonIndex == 1) { // Photo Library
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary] == YES) {
// Create image picker controller
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
// Set source to the camera
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.allowsEditing = YES;
// Delegate is self
imagePicker.delegate = self;
// Show image picker
[self presentViewController:imagePicker
animated:YES
completion:^(void) {
}];
}
}
如您所见,我显示它们完全相同,但相机编辑与照片库编辑的行为不同。
最佳答案
看起来这种行为只是 iOS 6 中的一个错误...基本上您不能移动编辑框,除非您放大一点,否则它总是弹回到中间。希望他们能尽快解决这个问题。
关于iphone - UIImagePicker allowsEditing卡在中心,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12630155/