Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

iOS Build a Playlist Browser with Objective-C Working With Multiple View Controllers UIButton Recap

UIButton Recap Challenge 1 of 2; keep getting syntax error, what gives!?

Hi no matter what I do this challenge keeps throwing back a compiler syntax error. I believe this may be a bug as I don't actually receive an error in Xcode itself. I tried writing the solution in Obj-C and Swift to no avail.

Challenge Task 1 of 2: Let’s assume we have an IBOutlet of type UIButton, named timerButton, as a property in our view controller header file. In the implementation file, set the title of the button to “Start!” for the state configuration UIControlStateNormal. Hint: Check out the UIButton class reference in the documentation.

#import "UIViewController.h"
#import "UIButton.h"

@interface ViewController : UIViewController

@property (strong, nonatomic) IBOutlet UIButton *timerButton;

#import "ViewController.h"

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

    UIColor *redColor = [UIColor redColor];

    // Enter your code below!
    [self.timerButton setTitle:@"Start!" forState:UIControlStateNormal];



1 Answer

Rebekah Shaw
Rebekah Shaw
18,687 Points
 [self.timerButton setTitle:@"Start!" forState:UIControlStateNormal];

That's what I did and it worked, not sure what is going on for you.

At the time that this was posted there was a bug with the compiler for Objective-C. Challenge was correct :)