List of fonts installed on the iPhone/iPad

I finally got around to updating this for the iPad. The project is setup for iOS 6. One other point I should add:
After converting this to support iPad, I noticed an annoying problem where the content of a given cell would “disappear” when the cell reappeared in the view after scrolling. Undrawn cells below or above the view would appear empty when first scrolled onto the screen. This only happened when the device, iPhone or iPad, was lying flat on a table. I tracked this down to a couple of issues with my cellForRowAtIndexPath method.
First, never do any more inside the if(cell==nil) clause than is needed in every cell. Remember if the cell is reused, anything inside that clause won’t get executed when another cell is requested. In this example. All I do is initialize the cell, set the minimum font size and constraint width of the text, every cell needs those. The text, which varies with each cell, is after the ‘if’ clause. Also, I had to replace initWithFrame with initWithStyle:reuseIdentifier, not sure why I was doing it the other way. The real problem I found is that, for example, when you place an iOS device flat on a table, [[UIDevice currentDevice] orientation] will always return UIDeviceOrientationFaceUp. My code was adding the text without considering this situation, so neither of my if/else clauses was executing, therefore no text. So I just check for landscape orientation and draw the text accordingly, or portrait when face up. That’s it.

Just a quick post to show how you can get a list of the fonts installed on the iPhone. There are lists available on the internet, but I was bored one day and decided to write an iPhone app that displays them all in a grouped table view subdivided by font family. Its based on some sample code I found here. The only problem with that code is that since it outputs the results to the console, you don’t know how the font actually looks. This little project displays each font string using the font itself. There’s also a simple example of how to create and initialize a table header view from a xib. Here’s the project. Sample output is here:
FontViewer output

I hope you find this useful.