tags:

views:

345

answers:

1

What do I need to do programatically in order to use the same background image for UIButton of variable size? (commonly known as 9-slice scaling or scale-9)

A: 

Check out:

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

In the UIImage class.

If I understand what you're looking for correctly, this while allow you to use one png to define how your button looks, and it will stretch to any size vertically or horizontally.

Nathaniel Martin