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 trialSeyran Basak
5,660 PointsChallenge task 2 Background Property
I know this must be a simple mistake but I can't seem to figure out task 2 here after trying it a bunch of times. Thanks for any help.
class ViewController: UIViewController {
let blueColor = UIColor(red: 0, green: 0, blue: 255, alpha: 1.0)
view.backgroundColor = blueColor
override func viewDidLoad() {
// Do any additional setup after loading the view, typically from a nib.
}
override func didReceiveMemoryWarning() {
// Dispose of any resources that can be recreated
}
}
2 Answers
jcorum
71,830 PointsSeyran, very close. You just changed the background color of the backing view in the wrong place. That line has to be in the viewDidLoad() function, i.e., after the view is loaded:
class ViewController: UIViewController {
let blueColor = UIColor(red: 0, green: 0, blue: 255, alpha: 1.0)
override func viewDidLoad() {
// Do any additional setup after loading the view, typically from a nib.
view.backgroundColor = blueColor
}
override func didReceiveMemoryWarning() {
// Dispose of any resources that can be recreated
}
}
Seyran Basak
5,660 PointsThank you jcorum! I knew it was something minor, I understand it now.
Bruce Röttgers
18,211 PointsBruce Röttgers
18,211 PointsSo thankful! I searched for it so long!