在线时间:8:00-16:00
迪恩网络APP
随时随地掌握行业动态
扫描二维码
关注迪恩网络微信公众号
开源软件名称:heitorfr/ios-image-editor开源软件地址:https://github.com/heitorfr/ios-image-editor开源编程语言:Objective-C 97.2%开源软件介绍:iOS Image EditorA iOS View Controller for image cropping. An alternative to the UIImagePickerController editor with extended features and flexibility. Drop me a line if your're using this on your apps, I would like to know. Features
UsageHFImageEditorViewController *imageEditor = [[HFImageEditorViewController alloc] initWithNibName:@"DemoImageEditor" bundle:nil];
imageEditor.sourceImage = image;
imageEditor.doneCallback = ^(UIImage *editedImage, BOOL canceled){
...
} Configuration PropertiessourceImageThe full resolution UIImage to crop previewImageFor images larger than 1024 wide or 1024 height, the image editor will create a preview image before the view is shown. If a preview is already available you can get a faster transition by setting the preview propety. For instance, if the image was fetched using the UIImage *image = [info objectForKey:UIImagePickerControllerOriginalImage];
NSURL *assetURL = [info objectForKey:UIImagePickerControllerReferenceURL];
[self.library assetForURL:assetURL resultBlock:^(ALAsset *asset) {
UIImage *preview = [UIImage imageWithCGImage:[asset aspectRatioThumbnail]];
HFImageEditorViewController *imageEditor = [[HFImageEditorViewController alloc]
initWithNibName:@"DemoImageEditor" bundle:nil];
self.imageEditor.sourceImage = image;
self.imageEditor.previewImage = preview;
...
} failureBlock:^(NSError *error) {
NSLog(@"Failed to get asset from library");
}]; doneCallbackThe callback block called when the image editor completes. Returns the cropped image and a BOOL that specifies if completion results from a cropSizeA CGSize specifying the width and height of the crop area in screen coordinates. NOTE: Currently cropRectA CGRect specifying the crop area in screen coordinates. Use instead of outputWidthThe width of the cropped image. If not defined, the width of the source image is assumed. minimumScale, maximumScaleThe bounds for image scaling. If not defined, image zoom is unlimited. checkBoundsSet to true to bound the image transform so that you dont' get a black backround on the resulting image. panEnabled, rotateEnabled, scaleEnabled, tapToResetEnabledBOOL property to enable/disable specific gestures Output Properties####cropBoundsInSourceImage Returns a CGRect representing the current crop rectangle in the source image coordinates. Source image coordinates have the origin at the bottom left of the image. Note that, if rotation has been applyed, then cropBoundsInSourceImage represents the bounding box of the rotated crop rectangle. InterfaceCreate your own xib for a custom user interface.
The demo app also shows how extended controlls can be implemented: three buttons are used for square, portrait and landscape crop. Use the subclassing hooks ( Licenseios-image-editor is available under the MIT license. See the LICENSE file for more info. |
2023-10-27
2022-08-15
2022-08-17
2022-09-23
2022-08-13
请发表评论