UIImage
Method :
- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight
.
Here the stretchable area is forced to be a single pixel high/wide.
I can not set the stretchable area, so I want to know: is there a UIImage category to do that?
After I googled, I found a lib.
Question: Is there a nine-patch loader for iPhone?
Announcement: http://blog.tortuga22.com/2010/05/31/announcing-tortuga-22-ninepatch/
This is a source pic, and I want to stretch the inside gray rect.
Thanks in advance.
One way to achieve this is using the below approach,
UIImage * backgroundImg = [UIImage imageNamed:@"bg.png"];
backgroundImg = [backgroundImg resizableImageWithCapInsets:UIEdgeInsetsMake(2,2, 2, 2)];
[imgView setImage: backgroundImg];
UIEdgeInsetsMake(2,2, 2, 2) is the amount of pixels you want unstretchable.