UIImagePicker pozwala na edycję zablokowaną w środku
Mam UIImagePicker, który działa idealnie dla typu UIImagePickerControllerSourceTypePhotoLibrary, ale gdy używam UIImagePickerControllerSourceTypeCamera, pole edycji nie może się przesunąć ze środka obrazu. Jeśli więc obraz jest wyższy niż szeroki, użytkownik nie może przesunąć pola edycji do górnego kwadratu obrazu.
Ktoś wie, dlaczego tak się stanie? Dzieje się tak tylko wtedy, gdy źródło pochodzi z kamery, a nie z biblioteki.
Edytuj: jakiś kod !!!
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) {
}];
}
}
Jak widać, wyświetlam je dokładnie tak samo, ale edycja kamery działa inaczej niż edycja biblioteki zdjęć.