Archive for December, 2008

iPhone Developer Tips Visitor Stats:
126,691 Pageviews and 94,296 visitors in the past 30 days.



Of BOOL and YES

It may not be immediately clear that the Objective C BOOL "type" is not actually a boolean type at all. This is a legacy from the original C language, which does not have an intrinsic boolean type (the iPhone GCC C compiler supports the ISO C99 standard which does define a bool type). To clarify, [...]

Objective-C

NSNumber versus NSInteger

If you’ve ever found yourself scratching your head thinking “now which one should I be using, NSNumber or NSInteger?” the short summary below should help. NSInteger is nothing more than a synonym for a long integer. What follows is how NSInteger is defined:

Cocoa

Write Debug Output to a File

NSLog definitely has its place in debugging. In a previous post I shared a version I wrote that skips displaying the date and object information, you can read more about the debug command I use on a regular basis here.

Debugging, General

Working with Bitfields

Given space is often at a premium when writing applications for mobile devices, I want to show you how to use bitfields to manage a series of values that need only on/off status. The upside is that you can store a surprising number of status values within a single integer, 32 to be exact. The [...]

C

Xcode Keyboard Shortcuts

I’ve always been one to prefer the keyboard over the mouse. It’s fair to say that moving from a command line environment to a GUI was not a quick or painless process.

Xcode

Stanford Offers iPhone Developer Course

Not one to lag behind in technology, beginning in the fall of this year, Standford University introduced an iPhone application programming class. Although nothing can replace the dynamics of actually attending a class in person, you can download the lectures slides and all sample code demonstrated in the class.

Announcements

Read and Write User Preferences

Reading and writing user preferences within iPhone applications is surprisingly easy given the NSUserDefaults class does most all the work for you. What follows is a short example to show how you can read/write two values, a boolean and an integer. The example assumes you want to save state as to whether a user wants [...]

Cocoa

Launching Your Own Application via a Custom URL Scheme

One of the coolest features of the iPhone SDK is an application’s ability to “bind” itself to a custom URL scheme and for that scheme to be used to launch itself from either a browser or from another application on the iPhone. Creating this kind of binding is so simple, its almost criminal not to [...]

Cocoa

Launching Other Apps within an iPhone Application (Part 2)

To continue on the types of URL Schemes that are supported by the iPhone (see Part 1); today I will show you how to: Launch YouTube “Deep Link” to content in iTunes

Cocoa

Adding Text Message to an ActionSheet

The ActionSheet supports one line of text, the title, which as the name implies, is displayed across the top of the Alert. See the image below for an example.

Undocumented

How to “fix” Subversion in XCode 3

If you don’t take the necessary steps to prepare for subversion, you will run into problems using it in XCode. This is because XCode produces files that “confuse” Subversion because it either thinks they are text files when they are really binary files or the reverse. To overcome these limitations, you need to make some [...]

Xcode

Class Variables

I previously wrote about the lack of support for private methods when working with Objective-C. As part of that post I presented a few work-arounds. Along the same lines, there are is no support for class variables in Objective-C. This post will explore this a little further and walk through a short example that shows [...]

Objective-C

How to Mask an Image

Masking an image enables a developer to create images with irregular shapes dynamically. Masking is often used to create a user interface that is more compelling and less boring. Take for example the following example …

Cocoa

Objective-C Object as a C Structure

Okay, so figuring out how to unwind an Objective-C object into its base representation goes against all that is object-oriented programming, however, it’s interesting none-the-less. In Objective-C there is a directive, @defs(), that outputs (at compile time) the list of instance variables for a class. We can use this list to create a C structure [...]

Objective-C