johnbakers
johnbakers

Reputation: 24771

Custom UIButton image buttontype

If you can set a button's image even if it's button type is rounded rectangle, then what is the purpose of the button type to begin with? I usually use the custom button type, but does this in fact actually make a difference?

Upvotes: 3

Views: 170

Answers (2)

Kapil Choubisa
Kapil Choubisa

Reputation: 5232

Yes this definitely makes a difference. For example, if you have two buttons, One RoundRect and the other 2nd Custom.

Try to set a background color on both buttons. You will see the difference. The Custom Button has occupied the background color properly and the round rect has few issues.

Even with background Image, you can check both. The Custom button has no issues with setting images, as it has a transparent background and the round rect will have an issue on its corners.

UIButtonType definitely have difference of this.

I hope this is what you are looking for.

Upvotes: 1

Sergey Kalinichenko
Sergey Kalinichenko

Reputation: 727027

You can use UIButtonType to make a button of a standard type: a detail disclosure, an info, and so on. In these cases you would not need to set the image at all - the system will do it for you automatically.

When you pick rounded rectangle and set the image, the image would be clipped to the rounded rectangle's border; when you pick custom style, there will be no clipping.

Upvotes: 2

Related Questions