Last updated by at .

5 Time Saving Tips In Xcode

Working with Xcode can sometimes be a frustrating experience…

However, Xcode has a few times saving features that really make a difference in day to day development. In this post we are going to break from the traditional format in order to examine a few of these features.

1. Snippets

Xcode snippets have gotten a bad wrap since they were introduced. This is mostly because they seem to lack some obvious features and are poorly documented. However, this doesn’t stop them from being an immensely powerful addition to Xcode. So let’s dive into using existing snippets and creating new ones.

[Read more…]

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…]

iOS Programming Recipe 18: Unit Testing With GHUnit & CocoaPods

This Recipe will cover using GHUnit to unit test the Weather Application we developed in Recipe 15: Building A Weather Application. GHUnit is an open source unit testing framework for Mac and iOS that (in my opinion) has capabilities superior to the unit testing capabilities built into Xcode. Many developers have there own philosophy on unit testing and this Recipe will not attempt to define another. We will not be defining unit testing best practices or even go into detail about writing particular tests. This Recipe is purely about getting started with GHUnit and how it can be used in the context of a real application. Oh and did I mention? GHUnit makes writing asynchronous unit tests a breeze!

Assumptions

  • This recipe uses the Weather Application created in Recipe 15: Building A Weather Application, it is highly recommended that you work through or at least familiarize yourself with that recipe before continuing on to this one.
  • Source code for the weather app can be downloaded via GitHub. The revision of the Weather App after Recipe 15 has been tagged recipe-15, make sure to start there.
  • This recipe also relies heavily on CocoaPods, it is recommended you watch NSScreencast’s video tutorial if you are not familiar with CocoaPods.

Getting Started

Download The Starting Application
  • First download the source code for our starting application, which happens to be the Weather App developed in Recipe 15.
  • Refer to Recipe 15 for details on setting up a Weather Underground developer account in order to obtain a personal API key. You will need this key in order to access Weather Underground’s services.
  • The Weather App was built using CocoaPods, so after getting the source code you will need to navigate to the project root directory (where the .xcodeproj file lives) and run the following command in terminal. Note this will not work if you have not yet installed CocoaPods, learn about doing so here.

1
$ pod install
  • This will add all of the necessary external dependencies the Weather App needs. It will also create an .xcworkspace file which you will need to open when accessing this project (not the .xcodeproj file).
  • Add your person API key for Weather Underground to WeatherAPIKey.h, then build & run the application. If everything has been done right you should now have a functioning weather application!

[Read more…]

iOS Programming Recipe 17: Using UISS To Theme Your Application

This Week I thought I would explore A nice iOS library which allows you to customize the look and feel of your application. While this library is built on UIAppearance, it extends it by introducing a CSS like way of defining the look and feel. We already had a recipe on UIAppearance, so we’ll start by creating the same thing and then explore customizations.

Assumptions

Setting Everything Up

Creating the Project

To get started we’ll need to create a new project and add the UISS library to it using cocoapods.

  • Create a new project and title it “Recipe17UsingUII”. Make sure to use ARC and select iPhone from the devices.

[Read more…]

iOS Programming Recipe 15: Building A Weather Application

This recipe will cover building a basic weather application for the iPhone from start to finish (no graphics needed, all code). Initially, this application will be very basic, but many enhancements/improvements may be the topic of future recipes. This recipe will move fast! If you find yourself having trouble keeping up you should go back and work through our earlier recipes before attempting this one. When you’re done with this recipe, you should have an app that looks like the following:

recipe15-8

Before We Get Started

  • This application will be built using CocoaPods which is an Objective-C dependency manager. If you are not familiar with CocoaPods or just need some help getting it installed please visit their website. Additionally, there is a very good video tutorial on CocoaPods that NSScreencast has done which is currently free to view. Make sure you get CocoaPods installed on your system before starting this article, because installation will not be covered in the recipe.
  • The application will also use API provided by Weather Underground which will require you to sign up for a free developer API Key (limited to 500 requests per day I believe). Don’t worry this is very simple and will be covered in the recipe.
  • The source code to this recipe is available online through GitHub, and it may help to check it out when working through this tutorial.

[Read more…]

iOS Programming Recipe 14: Implementing A UICollectionViewController

UICollectionView is great for displaying information in a grid or other custom layouts. In iOS 6 you’ll see collection views most likely used in many apps such as the podcasts app for viewing different podcasts. Since in most cases you’ll want to use UICollectionViewController, we’ll focus on that for this recipe.

Assumptions

  • You are familiar with Xcode and setting up a single view controller. If not check out our recipe on Xcode first.

Setting Up The View

Go ahead and create a new single view controller project. I titled mine “CollectioViewFun”. When the project opens up, You’ll want to delete the single view controller from the storyboard and drag a new collection view controller in it’s place. This should look like the following:

CollectionViewController

Now since our class type has changed from a standard view controller to a collection view controller we’ll want to change the class type in the viewController.h file as well. Go ahead and change the class name from ViewController to CollectionViewController as well. Don’t forget to change all instances of the term “ViewController” in both the .m and .h files:

[Read more…]

iOS Programming Recipe 11: Using The UITableView Part II

In Part I of this recipe we left off with a UITableView that Displayed some creatures which were grouped by type. In this Recipe we’ll be extending the functionality a bit and emplement a delegate in order to handle a touch event. In addition, we’ll take a minute to explore styling of the table view and cells.

Assumptions

  • You Have already read through Part I, if not read through that first.

Styling The Table View

The next two sections will be brief, but I thought it was worth visiting since there are a few things that can be done right from the property inspector.

First of choose the tableview object from the storyboard and go to the property inspector tab on the top right hand pane. Choose Grouped from style section and go ahead and change default to some color, I change mine to blue.

[Read more…]

iOS Programming Recipe 11: Using The UITableView Part I

In most apps you’re sure to find a table view whenever a list of items needs to be presented. UITableView, similar to UIPickerView, declares both a data source and delegate protocol. The data source protocol is required while the delegate is optional. We’ll need to make use of the data source protocol for the UITableView class. For this recipe I chose to show a table view with bugs and animals shown. The bugs and animals will have seperate sections.

Assumptions

  • You are familiar with Xcode, if not familiarize yourself here.

Setting Up the View

First start with a single view controller project. Now drag a UITableView object onto the existing view from the object library and then drag a UITableViewCell onto the newly created table view. When you’re done you should have something that looks like this:

[Read more…]

css.php
Privacy Policy