Cocoa Touch

Objective-C Snippet Tutorial - The UIAlertView


Posted in:

Displaying a message box in an iPhone application is something I have to look up almost every time. I decided it was time to create a tutorial on the subject - then maybe I'd actually remember the syntax. This tutorial will be short, but should cover pretty much everything you'd need to know in order to show alerts in an iPhone application.

Read More Icon Read More

Book Review - Learning Cocos2D


Posted in:

Learning to program is hard and one of the ways to make the process easier is by reading and using books. With our book reviews here at Switch On The Code we try to help you figure out which books are the best for any level of developer. In this review I'm going to go over the iOS game programming book Learning Cocos2D - A Hands-On Guide to Building iOS Games with Cocos2D, Box2D, and Chipmunk. written by Rod Strougo and Ray Wenderlich.

Read More Icon Read More

Mac Tutorial - How to Burn an ISO Image


Posted in:

After ruining a disk attempting to burn an ISO image, I thought it might be a good idea to share with everyone else how to correctly burn an image to a CD or DVD on a Mac. My first attempt consisted of right mouse clicking on the .iso file and selecting "Burn 'myImage.iso' to Disk..." This, of course, was taken a bit too literally by OSX and instead of receiving a disk with the contents of my image, I received a disk that contained the image file itself.

Read More Icon Read More

Saving Settings using NSUserDefaults Class


Posted in:

Saving simple configuration options can be a chore unless you've found the right object. Today we're going to cover the NSUserDefaults object, which makes saving settings quick and easy. The app we're going to build as an example is a basic segmented control that will remember which button you've selected between launches.

Read More Icon Read More

How to Create and Populate a UITableView


Posted in:

It seems like every time I create an iOS application I use the UITableView. It's a very common control found in a lot of applications, however it's also one of the most difficult controls to use. Every time I use one I have to go out and find examples so I can remember what I'm supposed to do. Because of that, I decided to create a basic tutorial that wraps up the most common usage patterns for the UITableView.

Read More Icon Read More

Apple Profiling Tools - Shark is Out, Instruments is In


Posted in:

As we sat down today to do some performance profiling in Shark, we came to a sudden realization - it doesn't work anymore with iOS4. After some quick Google searching I came across a thread in Apple's developer forum (registration required) that indicated there were no plans to bring iOS4 support to Shark.

Read More Icon Read More

Loading Images Asynchronously on iPhone using NSInvocationOperation


Posted in:

The iPhone SDK often makes doing things very easy, as long as you know where to look. Loading an Image into an UIImageView is one of these things. The problem I ran into, however, was that loading the image took too much time when performing the operation synchronously. To my surprise it wasn't much harder to load the image on a background thread. This was easily accomplished using NSOperation, specifically the prebuilt subclass NSInvocationOperation.

Read More Icon Read More

Finding Memory Leaks in iPhone Code


Posted in:

The video tutorial below shows how to use the performance tools that come with the Apple development kit to find memory leaks in Cocoa and Cocoa Touch code.

Read More Icon Read More

AppKiDo - Making Cocoa Touch Documentation More Accessible


Posted in:

I enjoy writing applications for the iPhone, not because I like Objective-C or Xcode but I really like seeing the application on my phone. This means I have to endure the other two. Being fairly new to the Cocoa and Objective-C world I spend a fair amount of time in documentation. This is always a mundane task but Xcode just makes it a completely bad experience. Recently I ran across an application that improves the task. The application is called AppKiDo.

Read More Icon Read More

iPhone Tutorial - Searching the Web with the Bing SDK


Posted in:

Microsoft recently announced a new SDK for Cocoa and Cocoa touch applications that would easily allow developers to perform various searches using their new Bing "decision" engine. As a person actively working on iPhone applications, this is something I had to try out. This tutorial will introduce you to the Bing SDK and how to use it to build a simple web search application.

Read More Icon Read More