Custom iPhone Fonts
2010.01.16Update 2010.03.08: Apple fixed this in the upcoming 3.2 SDK update. You can supply a list of custom fonts for the key UIAppFonts in the Info.plist file and they'll be loaded from the application bundle and made available for use in your application.
The iPhone SDK (as of version 3.1.2) doesn't provide any easy way to load custom fonts.
Here's a function that will load all .ttf fonts included in your application bundle and make them available for use in your application. Unlike some other solutions I've seen (FontLabel for example), fonts loaded in this manner can be used just like built-in fonts. i.e., [UIFont fontWithName: size:] simply works as usual.
#import <dlfcn.h>
void loadFonts()
{
NSString* frameworkName = @"com.apple.GraphicsServices";
NSBundle* frameworkBundle = [NSBundle bundleWithIdentifier:frameworkName];
if (frameworkBundle)
{
const char* frameworkPath = [[frameworkBundle executablePath] UTF8String];
if (frameworkPath)
{
void* graphicsServices = dlopen(frameworkPath, RTLD_NOLOAD | RTLD_LAZY);
if (graphicsServices)
{
BOOL (*GSFontAddFromFile)(const char*) = dlsym(graphicsServices,
"GSFontAddFromFile");
if (GSFontAddFromFile)
{
NSArray* files = [[NSBundle mainBundle] pathsForResourcesOfType:@"ttf"
inDirectory:nil];
for (NSString* fontFile in files)
GSFontAddFromFile([fontFile UTF8String]);
}
}
}
}
}
Although this code is pretty safe and will likely continue to work through iPhone OS updates, it makes use of APIs that Apple might consider 'private'. Caveat emptor.
Best Dog Ever
2009.08.25Reese
Born: ?
Died: Tuesday, August 25, 2009

Coldplay
2009.07.12The Gorge Amphitheater. 18th row from the stage. Dead center. Simply Awesome.
The 2.5 hour drive to the middle of nowhere coupled with the one hour nightmare of un-parking after the show was completely worth it. Got to bed at 3am.
As an added bonus Amadou and Mariam was one of the openers. African pop at its best.
As you can see, the new iPhone 3GS camera is a big improvement over the the 3G.

Judith
2009.04.03Mainstream game development seems to be somewhat lost. Successful game IP has become a huge cornerstone of the industry, and it spawns never-ending sequels, ports and spinoffs. The continuing quest for photo-realism has driven game development for the past 20+ years, but the end is in sight. Realistic physics and AI are following immediately behind photo-realism as drivers. Gaming as an artistic medium has suffered as a result. Few games tell a compelling story or generate real emotional responses. Very few games have risen to the level of art. Movies and novels have had more time as a medium, but where are the games worthy of being compared to movies like Blade Runner or books like Animal Farm?

In contrast, independent game development has come a long way over the past few years. The tools game developers use have improved significantly, and many are available free or at relatively low cost. Wheels don't need to be reinvented - game creators can concentrate on their ideas more and their code less. Simple games can be developed in hours in some cases, provided they don't need significant media assets. The independent game development community really is creating games for artistic sake, without regard for financial reward.
This post was motivated by playing just such an indie game. Terry Cavanagh and Stephen Lavelle just released a new game entitled Judith. It's an interesting 20 minute diversion built on a Wolfenstein-type engine. It's a short story about control told from two different narrative viewpoints separated in time, but not in space. Its 8-bit graphics and sound generated more real emotion than I've felt in a long time playing anything. Of course it's not Blade Runner or Animal Farm, but it is an honest step towards art in games.
It's available for download here with Windows, Mac OS X and Linux binaries.
Hiding the iPhone Status Bar
2009.01.25Update 2009.06.17: Apple fixed this in the 3.0 SDK update. XCode now lists all of the iPhone specific Info.plist entries in the drop down for the key column. Status bar is initially hidden is the label for the UIStatusBarHidden key I describe below.
The iPhone status bar is the bar at the top that shows the carrier signal strength, time and battery indicator. Sometimes you want to remove this bar to get some extra real estate. Both code and configuration methods for controlling the status bar are well documented, but in the latter case, while what to change is obvious, how to change it isn't.
For configuring your iPhone application to hide the status bar, you need an entry in the Info.plist file. The entry you need to add has a key of UIStatusBarHidden and a value of true. The important thing is that it needs to be a boolean attribute. There are two ways to create an appropriate entry.
First method: You can edit your Info.plist file as a text file (by right clicking on the Info.plist file and choosing Open As > Plain Text File), and add the following entry:
<key>UIStatusBarHidden</key>
<true/>
Second method: Add an attribute in the XCode property list editor. It defaults to string types for new attributes. To change the attribute from the default string to a boolean right click the row for the attribute and choose Value Type > Boolean. Make sure you don't have a pre-defined key selected from the drop-down as it won't let you change the value type for those pre-defined keys. Also, make sure you aren't actively editing the text field, otherwise you'll get the wrong contextual menu popping up. This would be easier if the property list editor in XCode simply had another column for value type with a drop down, which is exactly how the Mac OS X property list editor works. They should've simply used that interface instead of coming up with a different interface for the XCode property list editor.
For completeness, you can hide the status bar via code by calling setStatusBarHidden:(BOOL)hidden animated:(BOOL)animated on UIApplication. The most logical place to call this is from within your UIApplicationDelegate's implementation of applicationDidFinishLaunching:.
