Voices That Matter

Archive for April, 2009

iPhone Developer Tips Stats:
Past 30 days - Pageviews: 88,766 Visitors: 61,679
Thank you everyone! Let's shoot for 100,000 by May. Pass it on...



Toggle an Integer Between 1 and 0

If you ever come upon a need to toggle an integer value between 1 and 0, consider using the bitwise exclusive-OR (^) operator in C to get the job done.
In a recent application I wrote a method with one parameter, an integer, that is expected to be 1 or 0. In creating a demo of [...]

C

Where Was Touch – Determinei if Touch/Point is Within Rectangle

I recently had to write a short chunk of code to determine when a user touches a specific rectangular region on the screen. Detecting this is nothing more than getting a reference to a CGPoint (x and y coordinates) of the location touched and checking to see if the point is within the rectangular bounds [...]

Event Handling

Default.png and Landscape Mode

In a previous post I showed how to start your application in landscape mode. One aspect that I didn’t cover, and has since come up in an application prototype, is how to get Default.png to cooperate such that it is shown with its content properly oriented as well.
My original inclination was to create Default.png to [...]

User Interface

Getting the iPhone User Name

The original tip I wrote (shown below) does retrieve the user name, however, giving its undocumented status as well as the returning a string with punctuation removed, the approach suggested by Pascal in the comment section is much better:

[[UIDevice currentDevice] name];

When running this code from my device it returns "John’s iPhone" and when running from [...]

Core Services

Specifying Simulator Only Code

There are times when you need to write code that is only applicable when working with the simulator.
As an example, I was recently working with an application that required the user to take a picture with their iPhone. Once the picture was taken the application was to show the image to the user, at [...]

Objective-C

Changing Views to Landscape Mode

As you well know, by default, iPhone applications launch in portrait mode. If you need to start your application in landscape mode, you can set UIInterfaceOrientation key in the plist file. The two possible values for this key are: UIInterfaceOrientationLandscapeLeft (iPhone home button will be on the left) and UIInterfaceOrientationLandscapeRight (home button on right).

Cocoa

Open Source Coverflow-Like Code

I’ve been on a hunt for an open source implementation of a Coverflow look alike. Thanks for to oldbeamer at Stackoverflow for answering the question I posted to find an open source version and many thanks to William Woody at Chaos In Motion.

Open Source

iPhone Distribution Build Cheatsheet

For anyone who’s been through creating a distribution build, Ad Hoc or for the App Store, you know all to well it’s no walk in the park. After going through this a few times, I began writing notes to myself, which eventually become a rather lengthy checklist.
I thought this same information might be helpful for [...]

Xcode