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 trialKjetil Korsveien
1,713 PointsI dont get the button text to switch color
@IBAction func showFunFacts() { let randomColor = ColorModel().getRandomColor() view.backgroundColor = randomColor funFactButton.tintColor = randomColor funFactsLabel.text = factModel.getRandomFact()
5 Answers
Kjetil Korsveien
1,713 PointsThink it's a bug.
Ivan Kazakov
Courses Plus Student 43,317 PointsHi, Kjetil. I've tested your code - and it works just fine.
Your code doesn't contain a closing curly brace - probably you posted not the whole body of the function and you are setting .tintColor somewhere later to a fixed color?
Tony Teixeira
14,823 Points.tintColor did not work for me either but .setTitleColor did.
@IBAction func loadFact() {
let randomColor = colorModel.getRandomColor()
view.backgroundColor = randomColor
funFactButton.setTitleColor(randomColor, forState: .Normal)
funFact.text = factModel.getRandomFact()
}
Daren Davis
6,929 Pointsbutton color doesn't change for me either. (Using Xcode 8.0)
Daniel McAteer
Full Stack JavaScript Techdegree Student 1,494 Points.tintColor didn't work for me either, but .setTitleColor worked. Using Xcode 7.3.1