Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS Build a Simple iPhone App with Swift Improving Our User Interface Adding a Pop of Color

Rogelio Valdez
Rogelio Valdez
6,244 Points

Tint color of funFactButton does not change.

I have a problem where the color of the UIButton does not change. I already used a println(funFactButton.tintColor) and the color is changing but it is not displayed.

What I tried: I changed the color of the UIButton in the attributes inspector to default and now the color changes to match the background (as expected) except at the beginning of the program since it shows as blue (default color). I think the Attribute Inspector is somehow overriding the change color or maybe I changed an option in there that does not let me change the color unless I have it default.

I tried using other color instead of default like dark color and the UIbutton will stay dark.

The problem with this solution: The first time the UIButton is displayed has a blue tint(default).

Anyone have an Idea of why this is happening?

1 Answer

Vittorio Somaschini
Vittorio Somaschini
33,371 Points

Hello Rogelio.

I am not sure what the issue could be here.

Can we have a look at your code please?

Rogelio Valdez
Rogelio Valdez
6,244 Points

I just figured out. It wasn't a code problem I was changing the color of the "UI button" (in the attribute inspector, manually) instead of the tint in the view (in the attribute inspector). As soon as I changed the color of the view to the kinda blue-greenish, the default color of the UI button became that same color. This did the trick.