iOSDev

Quirk of the day - NSMakeRange

Oscar Wilde may have said "Consistency is the last refuge of the unimaginative", but consistency in method and function names has a lot to recommend it.

For example, given the ever popular and useful …

CGTypeMake

… you would be forgiven for expecting there to be …

NSRangeMake

But no, instead it's …

NSMakeRange

My poor old neurones are taxed enough without this.

As a random aside, years ago (decades in fact) I enjoyed exploring IBM's AS/400. The command language had a beautifully consistent system of concatenating three letter abbreviations to form commands. So if you didn't know the command to power the system down, you could take a pretty good guess that it would be "pwrdwnsys". Want to do it right now, just add a "*immed". Hours of fun.

Xcode tip - expanding block placeholders

Here is a simple Xcode feature which has made me very happy recently. It is probably known to many, but I only just stumbled on it and it solves something that had been bugging me.

Xcode's feature to suggest auto-completions for method names etc is a great help. My issue was when the method takes a block as a parameter. Xcode inserts a placeholder for the block which I would select then type the block prototype (return type and parameters). As soon as you start typing the placeholder disappears and I would have to type the prototype from memory.

Before

The feature I was not aware of is that double clicking on the placeholder replaces it with the block prototype, with a new placeholder for the block code.

After

How cool is that?

Update

on 2014-02-27 11:11 by John

Thanks to @ffried on app.net for pointing out that just pressing enter on the placeholder has the same effect. My Xcode ignorance knows no bounds :)

App icon layout guides for Acorn

I am very fond of Acorn, the inexpensive but feature rich graphics program for Mac by Flying Meat. I have spent many happy hours in Acorn fiddling with images for my apps, including the trump cards for Grimes and Racing Demon and the achievement badges in Grimes.

Another task I do in Acorn is putting together app icons. I have an unfortunate habit of putting elements of the icon too close to the corners. When the app is on a device the corners are rounded and the icon looks odd. To help me avoid this I have created a layer in Acorn that provides a set of guides to help me lay out the icon, and in particular to keep aware of the corners. I add this layer to my Acorn icon files and hide it when I don't need to see the guides.

Icon guide

There are similar things around the net in Photoshop formats. My Acorn equivalent at 1024x1024 pixels is here, feel free to use it if it helps you.

Happy Acorn iconing.