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 trialTom Lau
12,169 PointsUIButton 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;
@end
#import "ViewController.h"
@implementation ViewController
- (void)viewDidLoad {
[super viewDidLoad];
UIColor *redColor = [UIColor redColor];
// Enter your code below!
[self.timerButton setTitle:@"Start!" forState:UIControlStateNormal];
}
@end
1 Answer
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.
Tom Lau
12,169 PointsTom Lau
12,169 PointsAt the time that this was posted there was a bug with the compiler for Objective-C. Challenge was correct :)