开发者

Flexible iPhone button

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜