How to create a custom button

- by

We can do this by setting properties of the UIButton for the states “normal” and “highlighted”. First we create pointers to the images, then we tell the button to use said images for each state:

If the button has transparency enabled use the “custom” setting in your Storyboard.
If the button should have a dynamic width to accommodate a changing text label you can use the following values:

UIImage *normal = [[UIImage imageNamed:@"greyoffbutton.png"]stretchableImageWithLeftCapWidth:12.0 topCapHeight:0.0];


If you enjoy my content, please consider supporting me on Ko-fi. In return you can browse this whole site without any pesky ads! More details here.

Leave a Comment!

This site uses Akismet to reduce spam. Learn how your comment data is processed.