开发者

Flexible iPhone button

开发者 https://www.devze.com 2023-02-18 20:46 出处:网络
Is there a way 开发者_如何转开发to create a flexible iPhone button from a single graphic, like Android does with 9-patch drawables?

Is there a way 开发者_如何转开发to create a flexible iPhone button from a single graphic, like Android does with 9-patch drawables?

For example, would it be possible to use this graphic

Flexible iPhone button

to create a wider button?


Yes. Load your image into a UIImage, then use stretchableImageWithLeftCapWidth:topCapHeight: with appropriate parameters to build a copy of the image with hints about the proper end caps. You can then assign this new image to the button.

See UIImage Class Reference.


Yes, look into the UIImage method -stretchableImageWithLeftCapWidth:topCapHeight:

0

精彩评论

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

关注公众号