Reputation: 91821
What's the difference between UIButtonType custom
, and system
. How will a property such as adjustsImageWhenHighlighted
affect the image(s) I supply?
What happens if I only supply some images and not others?
Upvotes: 5
Views: 3685
Reputation: 91821
TL;DR
If you want to supply a single image, your best bet is a System button which automatically lightens the image in the disabled and highlighted states.
If you want more control over the images, you should use a Custom button and supply up to 4 images.
It's very confusing because there are many properties that affect the appearance of a button:
Even with just these limited amount of properties, there are 256 (2^8) different combinations for a button. Just displaying let alone reasoning about all the options is a difficult task.
Furthermore, there are several other factors that affect the appearance of a button which are beyond the scope of this answer:
Assuming we only pay attention to the properties outlined above, here are 64 of the 256 possibilities:
I used these as the images:
Some notes about naming:
adjustsImageWhenHighlighted=true
and adjustsImageWhenDisabled=true
adjustsImageWhenHighlighted=false
and adjustsImageWhenDisabled=false
isSelected=false
isEnabled=false
isHighlighted=false
isSelected=true
isEnabled=true
isHighlighted=true
isSelected=false
isEnabled=true
isHighlighted=false
.Some observations:
Se
state always fallback to the normal image. It doesn't use a shade of the S
state.adjustsImageWhenHighlighted=false
seems to be ignored for System buttons in the non-selected state!UIButton()
, the default buttonType
is custom
.Upvotes: 23