Memention Blog

Make It Work

I read an interesting dev tip by Erica Sadun at TUAW. It was about creating button images with the help of an undocumented class left in the simulator. Neat. Why not try to make a slightly more convenient app to create buttons?

Said and done. It wasn’t to hard to whip together a small app that easily saved two images to the /tmp directory. But, now to the reason for this blog entry. I really wanted those images to be opened in Preview to be viewed and saved in another location if I wanted to. First I was hoping that some parts of the Mac OS was still available to be used for ie calling system(..) with a command to open the image files in Preview. Well, I couldn’t find anything working to reach out of the simulator. So, how could I make this work?

I remembered that the output of NSLog(..) are also outputted in the system log. Why not make a simple monitor script that trigger on a special output? Not a nice solution, but it works. The monitor script was really easy to create using tail -f and awk.

Want to see how I did it all? Grab the Xcode project at github

The monitor script is called LOG_MONITOR and can be started from within Xcode, just ctrl-click it and select Open With Finder and it should open a Terminal window. Now run the CreateButton app in the simulator and press Preview. This should bring up the two images, one for the normal button and one for the pressed button.

By Edward Patel, 22 Feb 2010

Show comments


Getting there13 Mar 2014
Throwing pebbles12 Jul 2013
Provision this!30 Aug 2012
Break what?18 Aug 2011
That old thing04 May 2011
Removing a Step15 May 2010
Make It Work22 Feb 2010
KISS server31 Jan 2010
tig on Mac12 Dec 2009
The XML Runner31 Oct 2009
Get some software from Memention
Powered by Jekyll and Disqus.
Copyright © 2010-2013 Memention AB