从图库或相机中挑选图像后 - 需要启用旋转,翻转编辑我该如何使用它。这是我的代码:
-(void)photofromCamera
{
@try
{
NSLog(@"2");
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self presentViewController:picker animated:YES completion:nil];
}
@catch (NSException *exception)
{
[self showAlert:@"Camera is not available"];
}
}
-(void)photofromGallery
{
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
picker.allowsEditing = YES;
picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self presentViewController:picker animated:YES completion:NULL];
}
所以在委托方法之后:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[self.imageDeletionButton setHidden:NO];
UIImage *chosenImage = [info valueForKey:UIImagePickerControllerEditedImage];
self.PostImageView.image = chosenImage;
[picker dismissViewControllerAnimated:YES completion:nil];
}
好像现在,如果我从画廊选择任何图像,相机 - 我需要显示裁剪,翻转,旋转。请帮助我如何实现。
提前致谢!!!
答案 0 :(得分:0)
您可以使用基于swift的框架IGRPhotoTweaks来旋转,翻转和裁剪图像。
您可以查看http://docs.nwjs.io/en/latest/References/Window/#winreloadignoringcache获取git和
对于cocoapods https://github.com/IGRSoft/IGRPhotoTweaks。
在框架cropAction()
和changedAngel(value: radians)
中,您需要尝试两种方法来实现您的要求。