Git Product home page Git Product logo

mobile-feather-sdk-for-ios's Introduction

Aviary iOS SDK Setup Guide

Contents

Overview

This document will guide you through the process of integrating the Aviary iOS SDK into your app, as well as configuring its interface and managing its resources.

Prerequisites

In order to follow this guide, you must have the iOS 5.0 SDK and Xcode 4.2 installed on your system. For the latest versions, please visit Apple's iOS Dev Center.

Build time requirements

In order to use the Aviary SDK, you must be using the latest version of Apple's LLVM compiler. You should not have a problem if you're using a fresh install of Xcode 4.2+, which uses this compiler by default. However, if you are working on an older project, or you have upgraded from an older version of Xcode, make sure you're not using GCC.

Run time requirements

The minimum iOS version supported by the SDK is iOS 4.0. The many reasons for this choice include our use of ARC (Automatic Reference Counting) and our reliance on a number of Apple frameworks and libraries which require iOS 4, including Accelerate and libdispatch.

Package Contents

The SDK consists of a static library, Objective-C header files, and one or more resource bundles containing configuration files and images. The static library is a universal binary for use on iOS device and simulator architectures (armv6/7 and i386).

AviarySDK/
|-- Headers/
|   |-- AFPhotoEditorController.h
|-- Resources/
|   |-- AviarySDKResources.bundle
|-- libAviarySDK.a

Note: you can view the contents of the .bundle files we distribute. In general, we do not recommend or support modifying their contents.

Quick Start

Setup

In order to use the SDK in an existing app, you must do the following:

  1. Project setup

    Make sure you're running Xcode 4.2+ and compiling with Apple's LLVM compiler (3.0+).

  2. Add files

    Copy the AviarySDK folder into your project (select "Create groups for any added folders" if needed).

  3. Link against libraries

    Check your target's "Link Binary With Libraries" build phase. Make sure your app is being linked against libAviarySDK.a.

    Link against the following libraries and frameworks:

     Foundation.framework
     UIKit.framework
     CoreGraphics.framework
     QuartzCore.framework
     Accelerate.framework
     StoreKit.framework
     libz1.2.5.dylib
     libsqlite3.0.dylib
    
  4. Copy resources

    Make sure AviarySDKResources.bundle is included in your target's "Copy Bundle Resources" build phase.

  5. Add linker flags

    Update your target's (or project's) build settings to include the following "Other Linker Flags:"

     -ObjC -all_load -fobjc-arc
    

    Note: -fobjc-arc is only required if you are targeting iOS 4.x.

  6. Import headers

    Include the following line to make the library available to your code:

     #import "AFPhotoEditorController.h"
    

Basic Usage

The simplest way to use the SDK is to create and display an instance of AFPhotoEditorController (a UIViewController subclass). You can present it modally, like so:

- (void)displayEditorForImage:(UIImage *)imageToEdit
{
	AFPhotoEditorController *editorController = [[AFPhotoEditorController alloc] initWithImage:imageToEdit];
	[editorController setDelegate:self];
	[self presentModalViewController:editorController animated:YES];
}

You may instead choose to display the controller in other ways, such as by presenting it within a UIPopoverController or by manually adding it to the view hierarchy. If you choose to present the controller in such a way, you are responsible for making sure it receives the standard view controller lifecycle methods, including viewDidLoad, viewWillAppear:, etc. The controller may be displayed at full resolution, or you may display it in a smaller portion of the screen.

At minimum, you should implement the following AFPhotoEditorControllerDelegate methods in your presenting view controller:

- (void)photoEditor:(AFPhotoEditorController *)editor finishedWithImage:(UIImage *)image
{
	// Handle the result image here
}

- (void)photoEditorCanceled:(AFPhotoEditorController *)editor
{
	// Handle cancelation here
}

You are responsible for dismissing the AFPhotoEditorController, which should typically be done in these delegate methods.

Customization

The editor can be customized at runtime by passing options to the -initWithImage:options: method (which is also the designated initializer of AFPhotoEditorController). This section describes valid keys and values that may be passed in a dictionary to the second parameter of this method. All of the valid options keys are instances of NSString. More information can be found in AFPhotoEditorControllerOptions.h.

Tool selection and ordering

  • kAFPhotoEditorControllerToolsKey

    This key allows developers to customize the visibility of, and order in which tools appear in the SDK interface. A valid value for this key is a NSArray containing NSString instances whose values match the constants below. The order of the constants below also represents the default tool order, when this option is unspecified.

      kAFEnhance      /* Enhance */
      kAFEffects      /* Effects */
      kAFOrientation  /* Orientation */
      kAFCrop         /* Crop */
      kAFBrightness   /* Brightness */
      kAFContrast     /* Contrast */
      kAFSaturation   /* Saturation */
      kAFSharpness    /* Sharpness */
      kAFDraw         /* Draw */
      kAFText         /* Text */
      kAFRedeye       /* Redeye */
      kAFWhiten       /* Whiten */
      kAFBlemish      /* Blemish */
    

Example

The code sample below illustrates how to pass options to a controller instance on initialization.

- (void)displayEditorForImage:(UIImage *)imageToEdit
{
	// Only display the Enhance, Effects, Orientation, Crop and Draw tools
	NSArray *tools = [NSArray arrayWithObjects:kAFEnhance, kAFEffects, kAFOrientation, kAFCrop, kAFDraw, nil];
	AFPhotoEditorController *editorController = [[AFPhotoEditorController alloc] initWithImage:imageToEdit options:[NSDictionary dictionaryWithObject:tools forKey:kAFPhotoEditorControllerToolsKey]];
	[editorController setDelegate:self];
	[self presentModalViewController:editorController animated:YES];
}

mobile-feather-sdk-for-ios's People

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.