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 Build a Playlist Browser with Swift Working With Multiple View Controllers A Recap with UIButton

How would I do this?

Thanks

ViewController.swift
class ViewController: UIViewController {

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

    override func viewDidLoad() {
        super.viewDidLoad()

        @IBOutlet weak vat timerButton: UIButton!
        var setTitle: UIButton = UIButton.setTitle()
          func setTitle(_ title: "Start")
    }

}

2 Answers

Hi,

These are a little fiddly, I agree. Try something like:

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

The documentation isn't mega-clear at all, unfortunately.

Steve.

Yes that worked, thank you.

Hi Matthew,

What are you trying to do here? Is this a code challenge or something you're working on yourself?

Either way, let us know what the intended end result is and we can help you fix it!

Steve.

These are the directions: 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.

And I can't seem to figure out how to format this all correctly.