UltraCam is a clone of Instagram app. It allows the user to take pictures, apply filters to the pictures and then share the pictures on Twitter as an attachment.
Ultra Cam is an iPhone app very similar to the Instagram that allows user to take pictures and apply different effects on the filters. Ultra Cam uses Core Image libraries provided by iOS 5 SDK to create and apply image filters. Ultra Cam also has the functionality to share the edited images using Twitter. Twitter integration has been performed by using iOS 5 Twitter SDK. The project shows how to implement the following:
The main project can be opened by version 4.2 and above of xCode. The UltraCam.xcodeproj is the project file. After installing xCode click on the UltraCam.xcodeproj file and it will automatically open in Xcode. The project will NOT run in the simulator since it uses the iPhone camera. You MUST run the project in an actual device.
The application is divided into multiple folders. The name and purpose of each folder is explained below:
Extensions: This folder contains all the extensions used in the application. For UltraCam project we have only used UIImage+Extensions which is discussed below.
The UIImage+Extensions files are responsible for scaling, cropping and rotating the images.
Model Folder: This folder contains the classes which service as the model for the application.
Filter.h and Filter.m:
These classes are a simple wrapper on CIFilter object. Filter class also expose a property called name which is used to designate a friendly name to the image filter.
Controllers: This folder contains the controllers used in the project.
ViewController.h and ViewController.m
This is the only controller used in the application and it contains code to take the picture, display the filters, apply the filters and finally tweet the image.
This folder contains the resources used in the application. These resources include images, icon files etc.
Setting up your Twitter Account:
In order to tweet the images you MUST setup the Twitter account in the settings section of your iPhone.
In this section I would like to highlight some of the main methods in the project.
setupAppearance in ViewController.m:
This method is responsible for setting up the preview filters scroll view control.
loadFiltersForImage in ViewController.m:
This method is responsible for creating different filters for the application. Once, the filters are created they are then added to the filters collection. You can get a list of all the available filters using the following code:
createPreviewForFilters in ViewController.m:
This method takes the filters collection and then apply the filters to the image and then add to the filter scroll view control to display the filters to the user.
applyGesturesToFilterPreviewImageView in ViewController.m:
This method is used to attach the single tap gesture recognizer to the UIView object displayed as a filter view.
applyFilter in ViewController.m:
This method is triggered when the user selects a particular filter. It applies the filter to the image and also highlight the selected filter.
initializeCamera in ViewController.m:
This method initializes the camera and shows the camera view to the user.