Android has a nice way of defining stretchable images called a nine-patch. See these docs for a description of the concept. The idea is to surround a png image with a 1-pi
I received an e-mail from Tortuga22 software who informed me that they have created such a library and released it under the Apache license:
Announcement: http://blog.tortuga22.com/2010/05/31/announcing-tortuga-22-ninepatch/
Source code: http://github.com/tortuga22/Tortuga22-NinePatch
Example usage:
// loads-and-caches ninepatch and rendered image of requested size
UIImage buttonImg = [TUNinePatchCache imageOfSize:buttonSize
forNinePatchNamed:@"buttonNormalBackground"];
[self.buttonNeedingBackground setImage:buttonImg
forControlState:UIControlStateNormal];