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 trialLana Wong
3,968 PointsMy tintColor in Xcode isn't working.
I am taking Swift 3 basics, and I copied what Pasan did for another project similar to the Fun Facts. My tint color isn't changing. Anyone know why this happens?
Lana Wong
3,968 Pointsimport UIKit
class ViewController: UIViewController {
@IBOutlet weak var LanaFactLabel: UILabel!
@IBOutlet weak var LanaSumonFacts: UIButton!
let lanaFactProvider = LanaFactProvider()
let colorProvider = LanaColorProvider()
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
LanaFactLabel.text = "Hi, I will be talking a little about myself"
view.backgroundColor = colorProvider.randomColor()//Not nessesary. I just did it, and it still works.
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
@IBAction func LanaFactButton() {
LanaFactLabel.text = lanaFactProvider.randomFact()
let randomColor = colorProvider.randomColor() //Struct. bg color
view.backgroundColor = randomColor
LanaSumonFacts.tintColor = randomColor
}
}
Kenneth Dubroff
10,612 PointsKenneth Dubroff
10,612 PointsCan you provide the code you used in your second project? Depending on your data structure, something earlier in your code may be causing that portion not to execute... among other things