UIImage 方法 :
- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapHeight.
这里,可伸展区域被强制为高/宽的单个像素.
我无法设置可伸缩区域,所以我想知道:是否有UIImage类别可以做到这一点?
用谷歌搜索后,我找到了一个lib.
公告: http ://blog.tortuga22.com/2010/05/31/announcing-tortuga-22-ninepatch/

这是一张源图片,我想要拉伸内部的灰色矩形.
提前致谢.
如何只重复部分图像,
有两个图像.
i.stack.imgur.com/KC0Pm.png
源pic是如上所述,我想将其更改为:
i.stack.imgur.com/t8CwQ.png
这意味着我只想重复部分图像?不延伸源图片,是否可以这样做?
谢谢 更新:
代码在这里:http://www.box.net/shared/cmtz0e48a5urtajxu4yn 还有问题!!
更新: 我裁剪我的图像文件,只是重复该部分,但我仍然有一些问题.
- (UIImage *)imageWithImage:(NSString *)iconName covertToSize:(CGSize)size {
CGRect topLeft,topRight,bottomLeft,bottomRight,top,bottom,left,right;
if ([iconName isEqualToString:@"border_baikuang"]) {
topLeft = CGRectMake(0, 0, 18, 18);
topRight = CGRectMake(108-18, 0, 18, 18);
bottomLeft = CGRectMake(0, 104-18, 18, 18);
bottomRight = CGRectMake(108-18, 104-18, 18, 18);
top = CGRectMake(18, 0, 1, 18);
bottom = CGRectMake(18, 104-18, 1, 18);
left = CGRectMake(0, 18, 18, 1);
right = CGRectMake(108-18, 18, 18, 1);
} else if ([iconName isEqualToString:@"border_fuguxiangkuang"]) …Run Code Online (Sandbox Code Playgroud)