Archives for April 2013

Last updated by at .

iOS Programming Recipe 22: Simplify UIAlertView with Blocks

Assumptions

Getting Started

Have you ever found yourself wanting to present an alertView to the user to get simple yes or no feedback? If you’re anything like me you were very annoyed that you were required to implement the UIAlertView delegate protocol just to handle this simple task.

Is There A Better Way?

[Read more…]

iOS Programming Recipe 21: Photo Filtering Using Core Image

This week I thought I would have a bit of fun and explore image manipulation using Core Image. This sounds like it could be pretty tough, but Apple has actually made this very easy. In this Recipe we’ll be creating a photo filter app that will let you choose a photo or take a photo using the camera and filter it.

Assumptions

  • You know the basics of Xcode, If not, we got you covered: Familiarizing Yourself With Xcode
  • You know how to create outlets and actions using the interace builder
  • You have a developer account and can run this app on hardware, This will be necessary if you want to capture an image using the camera

Setting Up the Project

Setting Up the Framework

Go ahead and start with a single view controller application using storyboards and title it “ImageFilterApp”.

For this App we’ll need to use the Core Image framework. To add a framework select the top level project from the project navigator on the left and scroll down in the main window to “Linked Frameworks and Libraries”. Here you can press the “+” button to add the new framework. When the dialogue opens choose the “CoreImage.framework” and press the “Add” button.

[Read more…]

iOS Programming Recipe 20: Using CAGradientLayer In A Custom View

This recipe will demonstrate how to use CAGradientLayer to add gradients to a custom UIView.

Assumptions

  • You should have basic knowledge of UIView and Core Animation, specifically CALayer.
  • Basic knowledge of autolayout usage in interface builder.

Getting Started

Setting Up A Sample Application
  • Create a new Single View Application in Xcode named GradientViewDemo. Make sure to check Use Automatic Reference Counting and uncheck Use Storyboards. Our demo app will also be iPhone only to keep things simple, but go ahead make a universal app if you like (everything we will do is applicable on both iPhone and iPad),
  • Create a new UIView subclass named NSCBGradientView. We added the NSCB class prefix, because this may be a valuable component to reuse in future projects and the prefix will help avoid name clashing.
  • Next, we need to add QuartzCore to the target. Do so by selecting the project file in the source list on the left, then ensure the GradientViewDemo target has been selected, select the Build Phases tab from the tab bar at the top, expand the Link Binary with Libraries, and finally click the + button in the lower left corner. Search for QuartzCore, and then add it to the target.

[Read more…]

css.php
Privacy Policy