Aviary是一个国外的非常强大的照片编辑器,各种功能,但是是以静态库的形式存在的,不开源,但是很好用。
1.到官网上面下载sdk https://github.com/AviaryInc/Mobile-Feather-SDK-for-iOS
2.把sdk整个文件添加到项目中,然后导入以下的framework
Accelerate.framework CoreData.framework CoreGraphics.framework Foundation.framework libsqlite3.0.dylib libz.1.2.5.dylib QuartzCore.framework StoreKit.framework UIKit.framework CoreText.framework OpenGLES.framework
3.再target中的build setting中的linking栏目中找到
Other Linker Flags然后添加
-ObjC -all_load -fobjc-arc
4.再需要进入编辑器的地方创建类的实例:
- (void)displayEditorForImage:(UIImage *)imageToEdit { AFPhotoEditorController *editorController = [[AFPhotoEditorController alloc] initWithImage:imageToEdit]; [editorController setDelegate:self]; [self presentViewController:editorController animated:YES completion:nil]; }
5.再编辑完成后会调用这个委托方法,在这个委托方法里面可以写对照片的进一步操作,
- (void)photoEditor:(AFPhotoEditorController *)editor finishedWithImage:(UIImage *)image { // Handle the result image here } - (void)photoEditorCanceled:(AFPhotoEditorController *)editor { // Handle cancelation here }
6.因为这个是静态库所以能改的东西很少,但是颜色还是可以改的
//设置编辑器的风格
AFPhotoEditorStyle *style = [editorController style];
UIColor *backgroundColor = [UIColor grayColor];
UIColor *foregroundColor = [UIColor whiteColor];
UIColor *accentColor = [UIColor grayColor];
[style setBackgroundColor:backgroundColor];
[style setAccentColor:accentColor];
[style setTopBarBackgroundColor:backgroundColor];
[style setTopBarTextColor:foregroundColor];
[style setTopBarLeftButtonBackgroundColor:backgroundColor];
[style setTopBarLeftButtonTextColor:foregroundColor];
[style setButtonIconColor:foregroundColor];
[style setButtonTextColor:foregroundColor];
7.好的,完毕。