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 trialTrey Thompson
1,547 PointsHow would I access the text attribute for the label and set the String? quoteLabel.text = "A stitch in time saves nine"?
This is not compiling
Trey Thompson
1,547 PointsSure. The objective was to set the text of the UILabel by using the text attribute on the class. When I click check work this is not compiling. I included the code below.
class viewController: UIViewController {
@IBOutlet weak var quoteLabel: UILabel!
@IBAction func quoteButtonPressed() {
//Your code here!
quoteLabel.text = "A stitch in time saves nine"
}
}
3 Answers
Bradley Maskell
8,858 PointsTrey Thompson Everything you have in your code is correct, you're just missing the period at the end of the string.
class viewController: UIViewController {
@IBOutlet weak var quoteLabel: UILabel!
@IBAction func quoteButtonPressed() {
//Your code here!
quoteLabel.text = "A stitch in time saves nine."
}
}
Trey Thompson
1,547 Pointslol thanks. That was driving me crazy.
Bradley Maskell
8,858 PointsBradley Maskell
8,858 PointsCan we see your code?