Creating custom buttons for Interface Builder

Hey guys, Does anyone know how to create custom buttons for Interface Builder? Instead of having only the regular Round Rect button, I want to have as a custom 3D button and some random background for this button, as someone can tell me how to do this, thanks

+5
source share
3 answers

You will need to find a third-party class (ideally with the Interface Builder plug-in so you can see it in real time in the IB file) or a subclass of UIButton or NSButton / NSButtonCell for Mac and provide your own 3D rainbow unicorn drawing behavior.: - )

The Builder interface can only show classes that it knows about - you cannot add behavior / modify existing drawing behavior there because it is the wrong tool for the job. You need to find someone else or a subclass in the code, and then tell IB about it.

Update based on OP comment

You can use -setImage:forState:to provide your custom image for given states.

+2
source

Perhaps the easiest way is to use the image as the background for the button. For example, you can use this tool to easily create buttons with gradients, http://itunes.apple.com/us/app/uibutton-builder/id408204223?mt=8

If you need something more interesting, maybe it's time to launch Photoshop; -)

0
source

All Articles