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 Objective-C Working With Multiple View Controllers UIButton Recap

Syntax around setTintColor?

Challenge requires setting a button's tint to red. Pretty sure I have the right method name with setTintColor, but I cannot seem to get the syntax correct. See my line after 'Enter your code below'. Colon or equals sign? UIColor object? Or the pointer *redcolor created by author? Do I even need UIControlStateNormal in that line?

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

@interface ViewController : UIViewController

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

@end
ViewController.m
#import "ViewController.h"

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.timerButton setTitle:@"Start!" forState:(UIControlStateNormal)];

    UIColor *redColor = [UIColor redColor];

    // Enter your code below!

    [self.timerButton setTintColor: *redcolor forState:(UIControlStateNormal)];


}


@end

1 Answer

Holger Liesegang
Holger Liesegang
50,595 Points

Hi erickwatson !

You might want to use

[self.timerButton setTintColor: redColor];

You don't need forState:(UIControlStateNormal) and you don't have to dereference the UIColor object redColor with an asterisk. Also you misspelled redColor by mistake.

Ugh. I could SWEAR I used that variant. Thank you!