Under The BridgeUnder The Bridge


Here’s a handy tool for your bitmap font creation needs, GameFontMaker:

… So, I present to you what I think may be the first native Cocoa bitmap font creation tool for games, GameFontMaker!

At least, I think it is… Maybe… I didn’t do a lot of research, but I have seen a lot of fellow iOS devs wishing something like this existed for OS X, as the only other alternative runs under Windows.

Even if it isn’t, I was getting sick and tired of my really awful bitmap font creation tool that used FTGL, SDL and duct tape and generally produced hideous bitmaps without a lot of fudging of numbers. This is much, much better than that.

Yep, it’s pretty basic so far, but it does the trick of stamping out any installed font into a .png and providing a descriptive xml file with glyph attributes, so hey that’s a start!


Project home page is here for latest build and now GPL’d source!

Runtime Compatibility

Here’s a good article on how to write code that deals appropriately with current runtime iOS versions:

Tips & Tricks for conditional iOS3, iOS3.2 and iOS4 code

Make sure you read the comments too; in particular, we like this trick for dealing with deprecated methods

Make a @protocol, eg DeprecatedMethods, that defines the deprecated methods, then cast, eg [x setText:@”foo”] to [(id<deprecatedmethods>)x setText:@”foo”]. No more compiler warnings, and the deprecated methods are still obvious in the source.

as we’re firmly in the “all possible warnings on, and warnings are errors” development style camp, but sometimes you just really have to use a deprecated method. That’s a very stylish method indeed of resolving that conundrum.

There is a particular kind of runtime compatibility that may cause you particular grief next time you’re updating though; MPMoviePlayerViewController is the new way to play movies in any target view, but it seems that the behaviour of the old MPMoviePlayerController has been changed when linking against the 4.0 SDK, so soon as you recompile your project hilarity ensues. Here’s an article over at Dr. Touch about the issues:

The 3.2 Hurdle of MPMoviePlayerController

as of today you’ll note it says

… I had to revert to compiling against SDK 3.2 and disable the 4.0 code for the time being. Will open an inquiry with Apple later…

So if you’ve got some MPMoviePlayerController code that needs updating, watch out for issues!


Here’s another post on dealing with the movie playing thing:

Getting MPMoviePlayerController to Cooperate with iOS4, 3.2 (iPad) and Earlier Versions of iPhone SDK


And another …

Play Video with MPMoviePlayerController in iOS 3.0 and 3.2/4.0

Accessing The Cloud

For those of us who haven’t bothered paying much attention to that whole server side of things, here’s a nice gentle introduction:

Accessing The Cloud From Cocoa Touch

Walks you through POSTing data to the server, which chances are you’ve had to handle at some point by now; but also shows some simple server PHP code for handling that data, and has some basic recommendations for server side development. Nothing too terribly deep, but if you’re as blissfully unconcerned with server programming other than “hire a web guy” as we’ve been to date, this would be worth a read no doubt!


Here’s an interesting looking abstraction for your local communication needs: ThoMoNetworking!

Writing network code for Cocoa or iPhone/iPad apps isn’t terribly difficult – but it’s not very exciting either.

Want to exchange objects between two processes, on the same machine or remotely, without having to dig down into the C API of Core Foundation? Then ThoMoNetworking is for you.

ThoMoNetworking gives you client and server classes that connect automatically via Bonjour – nothing to do on your side. Pass an object to the server, and it will pop out at the client, and vice versa. If you want, have your object distributed to all connected clients in one go. It couldn’t be much simpler.

No, it really couldn’t. A handful of lines for all this, working with any object conforming to NSCoding:

But wait, there’s more that you get for free with ThoMoNetworking without having to worry about it ever again:

  • Sockets – we use them so you don’t have to
  • Bonjour – your servers and clients will find each other on the local network automatically, no need to mess with IP addresses and port number
  • Handling dropped connections – ThoMoNetworking will immediately reconnect or notify you if the other side is no longer available on the network
  • Asynchronous network calls – we handle all the threading for you so that your main thread does not have to wait for the network

All your base are belong to us – works out-of-the-box on OS X, iPhone, and iPad.

That does look pretty darn handy, indeed. Especially if you have some desktop <-> iDevice connectivity in mind. Download the source here!

h/t: MacOSXHints!

Tip: Quit In iOS4

So there’s certain classes of apps for which being backgrounded under iOS4 is more trouble than it’s worth; and if you’re wishing you could have the old school behaviour back and to Hades with this multitasking thing, here’s the trick

Fortunately there is a simple way to make your iOS 4 apps terminate for real when the user taps the home button.

This is a simple process:

1. Open your info.plist file

2. Add The Key UIApplicationExitsOnSuspend

3. Set the new key to YES

Now your applicationwillterminate: method will be run when the user taps the home key, and your app will exit for real.

Now you know!

Tip: Animating UIButton

File this one under “obvious once you think of it”: if you want to have a UIButton with some kind of animation effect, but that seems complicated since a UIButton can only have a single image specified; well then as described here, just create an animatable UIImageView,

NSArray *images = [NSArray arrayWithObjects:

   [UIImage imageNamed:@"image0.png"],

   [UIImage imageNamed:@"image1.png"],


imageView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"image0.png"]];

imageView.animationImages = images;

then add it as a subview of a custom button!

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];

button.bounds = self.imageView.bounds;



Which can then be made into a UIBarButtonItem if you like,

UIBarButtonItem *barButton = [[[UIBarButtonItem alloc] initWithCustomView: button] autorelease];

And then just call [imageView startAnimating] to get your pretty pulsating or whatever action going.

TwitterConnect: DDSocialDialog

Here’s a handy piece of UI support for the next time you need to put a Twitter login into your app: DDSocialDialog!

I am working on an iPhone/iPad universal app these two weeks, and it allows user to share over Facebook, Twitter or Plurk social services.

And since FacebookConnect SDK had provided a well-known dialog design, I would like to follow it, and to create a similar dialog UI for consistent user experiences in my app.

DDSocialDialog is a UIView subclass looks like FacebookConnect dialog,


And it comes with some features:

  1. Easy to use, just like UIAlertView.
  2. A DDSocialDialog dialog with an empty contentView for customizing.
  3. A extended DDSocialLoginDialog dialog for retrieving username and password.
  4. Two themes: Twitter and Plurk. And you can create your own if you like.
  5. Optimized for different resolutions, including iPhone, iPad and iPhone 4 (Retina Display, 960 by 640).
  6. Support orientations, you can rotate with keyboard on or off. This part is acting better than FacebookConnect SDK.

Yes, what’s not to like there? Certainly vastly more attractive and functional than our wireframe quality Twitter login views to date, that’s for sure. Haven’t had any requests for Plurk yet … actually, we were completely unaware of its existence until just now … but hey throwing that in as a bonus can’t hurt.

Irregular Buttons

Let’s say that you want to have buttons that are irregularly shaped, and there’s some reason that the standard hit testing which does not check image content is undesirable for some reason, like if you have overlapping buttons like this:

overlapping buttons.png

… well, first off, you should fix your interface. But let’s assume further that there actually is a good reason, like “you’re being paid” for instance, to implement something like the above: well, then, here is how to go about turning a button’s UIImage into a hit testing mask:

Irregularly Shaped UIButtons with update here linking to latest code.

There is an alternative implementation here, as well:

OBShapedButton: Non-rectangular buttons on the iPhone

So there you go. Even if you design sensible interfaces so this exact application isn’t of great interest to you, these implementations involve UIImage content dissection that could very well be of use in other situations, so the code’s worth a look.

PayPal MPL

[EDIT: Discontinued.]

So you may have noticed in that list of commercial components yesterday that there was one called “PayPal Integrator”. That was a particularly interesting one, we thought, as we’re not particularly interested in commercial credit card or cheque processors at the moment, but we do have a PayPal account; and we weren’t aware it was possible to connect to PayPal from an iPhone app, so how are they managing that?

Turns out that there is indeed an iPhone friendly official PayPal library, the “Mobile Payments Library” — and it’s been in public beta for two months, and there’s already apps in the store using it, like this sample:


That is indeed vastly more convenient than redirecting people buying physical goods out of your app to a Safari page as we’ve been doing, isn’t it? OK, onto the ever-lengthening list of things to do as soon as possible, let us add “checking out the PayPal library”!

Connectivity Components

So, you got a need for some unfamiliar kind of connectivity in your iPhone/iPad/Cocoa app? Well, there’s these people /n software who have quite the extensive selection for you, here’s the ones that are shipping for the iPhone in particular:

IP*Works! — FTP, HTTP, SMTP, POP, IMAP, LDAP, DNS, RSS, SMS, Jabber, SOAP, WebDav, RAS, XML, and more


IP*Works! S/MIME — secure SMTP, POP, IMAP, NNTP, and more

IP*Works! SSH — SFTP, SCP, tunneling, and more

Paymentech Integrator

Vital/TSYS Integrator

FDMS Integrator

E-Payment (cc/ACH) Integrator

E-Banking (OFX) Integrator

PayPal Integrator

QuickBooks (QBXML) Integrator

Amazon (S3/SQS/EC2/AWS) Integrator

Shipping (FedEx/UPS/USPS) Integrator

MS SharePoint Integrator

Not exactly what you’d call cheap any of these, but hey, if you need it right now then there you go!

h/t: iPhoneDevelopmentBits!