- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth topCapHeight:(NSInteger)topCapWidth;
|
Creates and returns a new image object with the specified cap values. | |
|
|
During scaling or resizing of the image, areas covered by a cap are not scaled or resized. Instead, the 1-pixel wide area not covered by the cap in each direction is what is scaled or resized. This technique is often used to create variable-width buttons, which retain the same rounded corners but whose center region grows or shrinks as needed. |
本文介绍如何使用UIImage创建内容可拉伸而边角保持不变的图片。通过设置左上角不拉伸区域的宽度和高度参数,实现按钮等UI元素在不同尺寸下保持一致的外观。
15万+

被折叠的 条评论
为什么被折叠?



