mpatric.com

Updated Thu 28 Nov 2013 by Michael Patricios , 8 comments

A while ago I needed to allow users to enter a monetary value into a text input in an iOS app. There seem to be a few approaches to doing this, such as:

  • Use a text field with a full keyboard and validate what the user entered, or only accept numeric input and a period or comma character
  • Use a text field with a numeric keypad, but don't allow minor units (cents/pence) as there is no period or comma character available on this keypad
  • Use spinners

To me, none of these options gives a good user experience; I find the best approach is what many ATMs do, which is to allow you to enter only the digits, but have a fixed decimal separator. So, to enter '123.45' you would type 1-2-3-4-5; to enter '18.00' you would type 1-8-0-0; and so on.

In this post, I am going to do this in iOS with a text input and a numeric keypad. The Objective-C code for this is available on github.

Decimal text input

Posted Sat 02 Nov 2013 by Michael Patricios , 0 comments

If, like me, you have iOS projects that use custom table cells in table views, you may have noticed that when rebuilding the projects for iOS7, table cells are always rendered with a white background, which means if your custom table cells have their own background you may not see it. The solution to this problem can be found in the UITableViewCell Class Reference:

Updated Wed 30 Jan 2013 by Michael Patricios , 0 comments

A while back I was searching for a way to launch applications on selected file(s) in the Mac OSX Finder using Hotkeys. This is different from launching the default application (Cmd-Down, Cmd-O or Double-Click the mouse) for a file as I sometimes want to launch different applications on the same file types - like a 'Right Click-Open With' using a mouse, or dragging a file onto an application in the dock or in the applications folder - but with fewer clicks and (more importantly for me) without using the mouse.

For example, I want the currently selected file(s) in the finder to be opened with TextMate when I hit Shift-Cmd-T, to be opened with 0xED when I hit Shift-Cmd-X and to be opened in VLC when I hit Shift-Cmd-V. I have managed to get this working and find this to be a great time saver, so I thought I'd share it.

Updated Sun 02 Sep 2012 by Michael Patricios , 0 comments

I recently built a simple retro snake game in javascript, with the game rendered on an HTML canvas and hi-scores in HTML local storage. You can play it online, or grab the source from github.

Canvas snake screenshot

Update: I've written a CoffeeScript version too, the source is on github.

Posted Tue 10 Jan 2012 by Michael Patricios , 0 comments

I've started using TexturePacker from Code'n'Web. There are versions for several platforms (including Mac OS X) and it can be easily integrated into your XCode build toolchain. It can also create standard definition textures and atlases from the high definition (i.e. retina-display) texture, and much more.. It has saved me a lot of time - if you're building a game with lots of sprite atlases, take a look at this tool. Well worth the US$24.95 asking price for the full version.

TexturePacker

Older postsPage 1 of 6