开发者

How to make an custom button with an self-stretching image?

I slightly remember that there is an class which is capable of stretching an image in such a way, that the first x pixels and the last y pixels won't get stretched.

For example if you have an button image with r开发者_开发问答ound corners, you would want those round corners to stay intact while the middle part of that image gets stretched.


This is a feature of class UIImage itself.

- (UIImage *)stretchableImageWithLeftCapWidth:(NSInteger)leftCapWidth  topCapHeight:(NSInteger)topCapHeight

You can assign the resulting image to the appropriate property of UIButton as required.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜