The R1 Effects SDK allows user's to edit photos using filters, borders, cropping, stickers, and text effects.
- XCode 4.6 with iOS 6.0 SDK
- Deployment target of 5.0 or greater
In order to use the SDK in an existing app, you must do the following:
- Project setup
Make sure you're running the latest version of Xcode and Apple's LLVM compiler.
- Download
Download the latest version of the Effects SDK from http://r1sdk.com/downloads
-
Unzip
Unzip the R1PhotoEffectsSDK.zip to a convient location
-
Drag
Drag the entire Unzipped folder into the project navigator of your XCode project. Ensure that
Copy Items into destination group's folder (if needed)
is selected Ensure thatCreate groups for any added folder
is selected Ensure that the proper target for you app is selected. -
Link against libraries
Check your target's "Link Binary With Libraries" build phase. Make sure your app is being linked against
R1PhotoEffectsSDK.a
.
Link against the following libraries and frameworks:
Foundation.framework
UIKit.framework
libR1PhotoEffectsSDK.a
SystemConfiguration.framework
OpenGLES.framework
QuartzCore.framework
AVFoundation.framework
CoreMedia.framework
CoreVideo.framework
CoreGraphics.framework
-
Add linker flags
Update your target's (or project's) build settings to include the following "Other Linker Flags:"
-ObjC -all_load
-
Import headers
Include the following line to make the library available to your code:
#import "AFPhotoEditorController.h"
First, enable the SDK in your Application Delegate's -application:didFinishLaunchingWithOptions: method. Use the key assigned to your app.
//Import the SDK
#import "R1EffectsSDK.h"
//Enable the sdk
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
{
[[R1PhotoEffectsSDK sharedManager] enableWithKey:@"asf232jnj98asfadfdf"];
//existing code...
}
To present the photo editor, create an instance of R1PhotoEffectsViewController, set it's delegate, assign a UIImage the user would like to edit and present it modaly. Implement the 2 required callback methods to handle the user canceling and finishing editing the image.
- (IBAction)buttonPressed
{
//create the view controller
R1PhotoEffectsViewController *photoEffectVC = [[R1PhotoEffectsSDK sharedManager] photoEffectsViewControllerWithCropSupport:YES];
//Assign the delegate
photoEffectVC.delegate = self;
//present the view controller
[self presentViewController:photoEffectVC animated:YES completion:nil];
}
- (void)photoEffectsViewController:(R1PhotoEffectsViewController *)controller didFinishWithImage:(UIImage *)image {
//Do something with the resulting UIImage
//For example:
self.imageView.image = image;
//Dismiss the editor
[self dismissViewControllerAnimated:YES completion:nil];
}
- (void)photoEditorCanceled:(AFPhotoEditorController *)editor
{
//Dismiss the editor
[self dismissViewControllerAnimated:YES completion:nil];
}