Monday, November 26, 2012

9-Patch on iOS

9-Patches are pretty common for Android Developers.  Furthermore, they're absolute essential for making graphics on the platform.  A while back to save designers time, TuneWiki for iOS used them for all of our stretchable assets.  Unfortunately, iOS does not have native support for it, and there's really only one library.   I used this 9-patch library for iOS with my modifications for @2x support.  I'd like to personally comment that it turned out to be a terrible idea.  The overhead for image processing we experienced slowed our app down considerably--so much so that every conversation about performance ended in "Could we please just have our artists make an extra set of images?".  Thus, we stopped using it.  The issue relies in having to extract 9 pieces from the original image, and redraw each one of them (5 pieces with modifications).  Despite me having contributed to the project, I recommend that no one consider using it.  Just demand your artists create separate images and use -[UIImage stretchableImageWithLeftCapWidth:topCapHeight:]


  1. There really needs to be native support for this format across the board. We're porting a project to iOS and, quite frankly, the lack of quick and useful image stretching is a challenge that may result in the iOS version being the weaker one. Discrete image sizes are not always the best option, no matter how many sizes you make for them, and UIImage is cumbersome and time-consuming to use.

  2. Apple may make it less demanding for clients to share recordings by including another web-based social networking application in iOS 10. find more info