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.