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 trial

iOS

Code Challenge: A Recap with UIButton

Challenge Task 1 of 1

Let’s assume we have an IBOutlet of type UIButton, named timerButton, as a property in the ViewController.swift file. In the viewDidLoad method, set the title of the button to “Start” for the state configuration Normal. Hint: Check out the UIButton class reference

Here's the code:

class ViewController: UIViewController {

    @IBOutlet weak var timerButton: UIButton!
    var redColor: UIColor = UIColor.redColor()

    override func viewDidLoad() {
        super.viewDidLoad()

        //Add your code below

    }
}

There's a method setTitle()

timerButton.setTitle("Start", forState: .Normal)

3 Answers

Didn't work bud. Got anything else?

Bummer! You need to use the setTitle method on timerButton.

add comma after "start", I forgot to add it. I edited my answer :P

I tried this and didn't work->timerButton.setTitle("Start", forState: .Normal);

That did work however I am still perplexed. I used the documentation and the docs for setTitle specify to use it as so

func setTitle(_ title: String?, forState state: UIControlState)

It did not specify to use the dot syntax method in the instructions.