Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Build a Simple iPhone App with Swift Improving Our User Interface Random Colors

Color of the button does not changes??

As I have choose background for button as yellow with my whole app background as yellow later when the background of app is changed the button does not changes its background and if the buttons tint colour is set to default that is tint the it changes its tint colour could anyone suggest me what can i do i am having an idea that we can change default tint colour of the button to blue from UIKit but i have no idea how would it be done .....CAn anyone guide me

3 Answers

Can you post your code? It will be easier so we can see exactly what's going on.

Its actually that the default color of my app background is set to yellow and same is the button but later when i click the button the background color of the app changes as if it is a variable(var) but the tint color of the button remains the same(Yellow) as if it is saved in a constant(let) thats what happens i have cross-checked the code theirs no problem in the code i think i am facing this problem because of the difference in version of Xcode so can anyone suggest me a way out......??????

Probably you accidently chose a Text Color from the Attributes Inspector panel. So no matter what your tint color is you always see the text color. To fix the problem, make sure your button's text color is set to default.

Missy Karman
Missy Karman
2,242 Points

I was having this same issue. To fix it, inside viewDidLoad(), I put funFactButton.tintColor = view.backgroundColor and this solved it.