Under The BridgeUnder The Bridge

Custom Alerts

So you need to put up something kinda sorta like an alert but custom and having a spot of trouble getting it quite right? Here’s a variety of approaches you may find of use:

UIProgressHUD replacement

A dropin replacement for the named private API, for a translucent black HUD spinner please wait type display.

Implementing a Wait “Alert”…

Another approach to imitating the private API, with some animation tips. Also note the sequel Tic-Tac-Toe Update post to imitate the GameKit peer picker.

Showing a “Loading…” message over the iPhone keyboard

How to find the keyboard view, if you want to dance on the edge of undocumented functionality.

Announcing DSActivityView

Another take on the progress displaying task.


And yet another.

And if what you’re looking for isn’t just a HUD replacement but a full on UIAlertView replacement but with being able to add edit fields and stuff with hokey workarounds or questionable API calls, here you go:

Custom Alert Views

Should be enough in all that to sort out pretty much any alert-type functionality you have in mind; but as always, Dear Reader, if you have anything relevant we’ve missed, please comment!


SVProgressHUD is reputedly a simpler and prettier MBProgressHUD alternative.

… and SVStatusHUD its cousin for orientation/volume change type HUDs.


So chances are you’ve had to work with some social services such as Twitter and Facebook already; but how about one library that provides

  • Delicious
  • Email
  • Facebook
  • Google Reader
  • Instapaper
  • Pinboard
  • Read It Later
  • Tumblr
  • Twitter

for images, URLs, text and files; allows offline queuing; and is MIT-licensed open source? Sounds pretty appealing, yes?

ShareKit: Drop-in Share Features for all iOS Apps

Well there you go then. From the introduction:

For developers, adding sharing features to an app is a source of dread. It takes a LOT of work for each service that you add. You have to learn each service’s API, probably learn OAuth, design and build UI to handle all the interactions of logging in and collecting information, and write code to make requests and handle all possible errors. You have to do this for every service and every service has a unique API. It makes it very difficult to add all of the services your users request.

In the iOS SDK we have access to MFMailComposeViewController. This is an Apple provided view that lets apps present an email dialog to the user. You feed it some starting values like a subject line and body content and it pops over your existing application, lets the user do their thing and goes away when they are done.

This is what I wanted in my apps. I wanted the same controller but for Twitter, Delicious, Evernote, and everything else. That’s what ShareKit is.

Yes, that certainly does look top of the list to check out for your next instance of social sharing needs, indeed!

h/t: iOS Development Goodies via ManiacDev!


SimpleAuth is a nice-looking alternative to ShareKit for the use case of simply wanting to authenticate users via their social accounts.


So you know that thing Tweetie.app, er Twitter.app, does where you swipe a table cell and get a bunch of commands revealed behind it? Feel like doing that in your app? Here you go, TGNWSwipeableTableView shows you how!

And reputedly, even better than the original — “fixes a problem Tweetie has, where you can’t swipe over the same row two times consecutively.”

Not too sure what we think of this as an interface feature in general, but if you do have lots of item-dependent contextual commands, it’s probably about as good as anything else one can come up with on an iPhone sized screen…

h/t: iOS Development Goodies!


We’ve mentioned various OpenAL helpers before, but here’s a new one that looks like a winner: ObjectAL for iPhone! From the most excellent documentation at the github wiki,


  • ObjectAL gives you full access to the OpenAL system without the hassle of the C API. All OpenAL operations can be performed using first class objects and properties, without needing to muddle around with arrays of data, maintain IDs, or pass around pointers to basic types.
  • BackgroundAudio provides a simpler interface to AVAudioPlayer, allowing you to play, stop, pause, and mute background music tracks. As well, it provides an easy way to configure how AVAudioPlayer will handle iPod-style music playing and the silent switch.
  • IphoneAudioSupport provides support functionality for audio in iPhone, including automatic interrupt handling and audio data loading routines.
  • SimpleIphoneAudio layers on top of the other three, providing an even simpler interface for playing background music and sound effects.

Naturally, just earlier today we shipped off an OpenAL-using project … but the next one, we’ll definitely be checking this out!

h/t: iDevGames via ManiacDev!


From the prolifically open sourcing Matt Legend Gemmell, here’s MGImageUtilities, some useful UIImage categories for your iPhone development:


This category lets you resize an arbitrary image to fit into a specified physical size, using one of four resizing methods:

  • Scale: scales the image proportionally to fit entirely into the required size, like UIViewContentModeScaleAspectFit.
  • Crop: scales the image proportionally to completely fill the required size, cropping towards its center. This is the most useful method, and works like UIViewContentModeScaleAspectFill.
  • Start: as for Crop, but crops towards the “start” of the image (the top or left, depending on relative aspect ratios).
  • End: as for Crop, but crops towards the “end” of the image (the bottom or right, depending on relative aspect ratios).


This category takes an image (presumably flat and solid-coloured, like a toolbar icon), and fills its non-transparent pixels with a given colour. You can optionally also specify a fractional opacity at which to composite the original image over the colour-filled region, to give a tinting effect.

Source is on github, enjoy!


Here’s a nice looking piece of code to help you out with that next great RTS game you’re planning on writing for the iPhone; from the same dude responsible for the awesome ASIHTTPRequest, it’s ASIPathFinder!

What is ASIPathFinder?

ASIPathFinder is a complete implementation of a cooperative path finding algorithm, and will probably be most useful for writing Real Time Strategy games. It is written in Objective-C, and is compatible with Mac OS and iPhone OS.

What is a co-operative path finder?


A co-operative path finder allows multiple objects to find a path on a map, planning ahead to alert other objects of where they’re going to travel. This means that an object can avoid other objects ahead of time, before they collide.

If you’d rather just see it in action, why yes there is an app for that:

ASIPathFinder is based on code I originally wrote for my Space Harvest game for iPod Touch and iPhone. Download the game to get a feel for its capabilities.


So there you go, BSD-licensed and everything, documentation here and project on github!


Introduction to A* Pathfinding

Introduction to A*

A* on Triangulated Spaces: Part 1 and Part 2

How To Implement A* Pathfinding with Swift

UI Automation

Here is a great walkthrough of how to get started with UI Automation that new UI scripting test goodness you may have noticed in the latest SDK, in between trying to get all your previous projects up to speed, if you’re anything like us:

In this post we’re going to look at the UI Automation library/tool that Apple added to iOS SDK 4.0. This is a huge step forward for test automation on the iOS platform. While it’s not without some compromises, it’s worth looking at to see if you can reduce the time you spend on manual testing.

UI Automation is both a probe for Instruments as well as a JavaScript library provided by Apple to exercise and validate a running application. In this case, “running application” isn’t restricted to the simulator—you can also automate the application on a real device. To my knowledge, this is the first time I’ve heard of anyone being able to do this.

This is huge. Having the ability to automate workflows in your application yields two benefits: you cut down on manual testing which saves you time, and you can rely less on your memory to execute all your tests. Instead, you just push a button (okay, two or three buttons) and run your full regression suite. Have I piqued your interest yet?

Excellent stuff!


And check out the post-mortem post, More UIAutomation!

Stress Testing And Hands-Free Screenshots With UI Automation introduces

iAds + Burstly

[EDIT: Discontinued.]

So you’ve probably checked some into the Apple iAd Network by this point and found they look pretty easy to set up, and perhaps you’ve heard that while the first few out of the gate with iAds are making some good coin at the moment, fill rates are pretty low; and just at a guess, we’d kinda suspect that iAd enabled apps are going to outstrip the growth in ads pretty seriously so you’re not going to be seeing Magical Money Fountain™ posts like that too much longer.

And besides that, there’s the issues that iAds are only available a) in the U.S. b) on iOS 4 devices. Both of which will probably become not so important in the future sure, but still some concern presently. What to do about that?

Well hey, look what’s out today:

Announcing Burstly 4.0 SDK with iAd Support

You may recall when we checked out Burstly a couple months back we were pretty impressed, although we haven’t got around to actually doing anything with it (that’s part of project #6 on the OhMiGAWDItsNotDoneYET List…) yet; so now that it includes the iAd network, looks like it’s even more so the preferred platform for your monetization efforts now. But be sure to let us know if you have any actual experience either way!


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