Rose Perrone
Rose Perrone

Reputation: 63576

UIColor noColor, but not clearColor

How can I get the UIColor for no color? Y'know, the color represented as a white square with a red diagonal line through it.

TLDR I'm trying to set the tint color of a UIButton in interface builder, but it's not playing nice, so I'm trying to do it programatically. If I set the button's tint color to [UIColor clearColor], the button disappears. The button only has an image, no text.

Upvotes: 1

Views: 1140

Answers (2)

BhavikKama
BhavikKama

Reputation: 8800

This property not available for all types of UIButton

You need to Use another buttonType.you can find this link useful.

the documentation also does not provide information that which specific button types support this property.

so..in general use custom button type

Upvotes: 1

Ashok
Ashok

Reputation: 6244

Create your button as custom...

[UIButton buttonWithType:UIButtonTypeCustom]

This will remove your red corner problem since i think your button is created as default (rounded rect) type.

You can set this in interface builder too (not necessarily create it programmatically).

Upvotes: 1

Related Questions