fill the void

Posts from November 2009

iPhone Tip: No NSHost

On the iPhone, I miss NSHost. CocoaTouch does contain a private version of this Cocoa class, but again, it is private. Recently, I needed to resolve a DNS name to an IP address in an iPhone app. It’s a one-liner in Cocoa: [[NSHost hostWithName:@"www.google.com"] address]. Not so on the iPhone without NSHost. So, with a [...]


Cocoa Tip: Extend NSNumber

As I mentioned in my last post, categories are such a nice addition to Objective-C. They allow me to wrap up new functionality in a standard class without subclassing it myself. Below, I extend NSNumber with two handy methods for printing out numbers and bytes in a human-readable version, turning 1,000,000 into 1 M and [...]


Cocoa Tip: Extend NSDate

Categories are a seemless way to extend existing Cocoa classes like NSDate. In my post on relative dates, I see if two timestamps land on the same day, by zeroing out the hour/minute/second components. Recently, while working on an iPhone app, I refactored it, converting it from a transformer into a category. @implementation NSDate (Utilities) [...]


iPhone WordPress Theme with WPtouch

A couple months ago, I was using Safari on my iPhone when I came across a blog with an amazing iPhone theme. It had a nice UITableView feel, with badges for comment counts and even an on/off switch at the bottom. And right below that, it said, “Powered by WordPress with WPtouch”. I thought, “Man, [...]


iPhone Tip: Fading Views In and Out

Most iPhone apps have a splash screen. It’s a PNG image called Default.png that gets automatically displayed (if present) when an app starts. Apple uses the image to make an app appear to load faster than it actually does, by making the splash screen a screenshot of the initial view. A couple days ago, I [...]