Firstly, it is deprecated, replaced by the more powerful resizableImageWithCapInsets: However, this is only supported on iOS 5.0 and higher.
stretchableImageWithLeftCapWidth:topCapHeight: does not resize the image you call it. It returns a new UIImage. All UIImages can be drawn in different sizes, but a limited image responds to resizing by drawing its caps at the corners, and then filling the remaining space.
When is this useful? When we want to make buttons from an image, as in this guide for iOS 5 .
The following code is the UIView drawRect method, which illustrates the difference between a regular UIImage and a stretchable UIImage image. The image used for stretch.png is taken from http://commons.wikimedia.org/wiki/Main_Page .
- (void) drawRect:(CGRect)rect; { CGRect bounds = self.bounds; UIImage *sourceImage = [UIImage imageNamed:@"stretch.png"];
Output:

Dondragmer
source share