Aviary 濾鏡 教程 照片編輯器
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.dylibQuartzCore.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.好的,完畢。