Interface Builder Tutorial on How to Configure UIButtons in Xcode 4.2

I am trying to create an iPad application that uses custom images as buttons with its own custom behavior when buttons are selected, touched inside, outside, etc.

I am trying to use Interface Builder for this, but I have many questions regarding what the various text fields mean, such as background image, shadow color, shadow offset, highlight hue, paint, etc.

Does anyone know of a good guide on UIBUttons on the Builder interface?

+1
source share
2 answers

Probably the best interactive custom button tutorial I've come across is at http://ios-blog.co.uk/iphone-development-tutorials/how-to-code-custom-ios-buttons/ . It explains how image stretching works, that the "header" settings are pretty good and in plain English. (In offline mode, among other things, I recommend the “Sliding up the button” section (p. 92) “Starting iPhone 3 development” by Dave Mark and Jeff Lamarche - if you have a book, of course.) I have not found other online tutorials quite detailed - as a rule, they represent only some code, but do not explain image stretching. Before running into the tutorial that I contacted, it took me a lot of experimentation to find out how the images should be presented.

Some additional sample code explaining the four different states of the buttons is, among others, programmatically adjust the background image of the iPhone button

+1
source

For starters, the default background image is scaled according to the content mode (if there is no default image). There are 4 states in which you can set the background image for "Default, Highlighted, Selected, Disabled."

You can set a specific action for any of the touch events listed on the 6th tab under the inspector (on the right side of my Xcode 4 setup). To do this, simply click and drag to the intended receiver. You do not need to click or right-click (this will not work from the inspector)

When you press Ctrl or right-click and drag the actual button in a hierarchical or layout view, by default it sets the purpose and action for Touch Up Inside

0
source

Source: https://habr.com/ru/post/1438265/


All Articles