--函数说明:
1.函数作用:创建一个内容可拉伸,而边角不拉伸的图片;
2.参数含义:
The leftCapWidth is the margin on the left side of the image that will not be stretched.If we set the leftCapWidth to 10, that means the first 10 pixels will not be stretched. What will be stretched is the next single pixel. Only that pixel and nothing more, and it’s always just one pixel. Finally, everything to the right of that single pixel will not be stretched. 就是说leftCapWidth这个值是不被拉伸的像素,它的下一个像素被拉伸,之后剩下的像素不拉伸,为“rightCapWidth”就是 total width(原图片宽度总像素) – leftCapWidth – 1.总而言之就是根据图片所占屏幕大小,将原图分为三部分,第一部分为leftCapWidth部分,不拉伸;第二部分为“下一像素”拉伸;第三部分为剩下的“rightCapWidth”部分,不拉伸. 参数topCapHeight原理类似.