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 trialChris Lopez
8,155 PointsHuh???
The instructions are very vague. this is my code
- (IBAction)button:(id)sender {
}
3 Answers
Dennis Walsh
5,793 PointsChristian,
Two things, one there should always be - or a + at the beginning of a method. This determines whether it is an instance method or class method. Second, this challenge is asking for a method with no parameters ( do not include :(id) sender ). That is not typical in iOS programming, as you usually want a reference to the object that was touched/pressed, which would be sender. These challenges can be a bit literal sometimes.
(IBAction)buttonPressed //method with no parameters
(IBAction) buttonPressed:(id)sender //this is actually more common
Dennis Walsh
5,793 PointsChristian,
Make sure that you use the same name as requested in the instructions, which should be buttonPressed. You just called is button, which is probably causing your issue.
Chris Lopez
8,155 Pointsok, thanks!
but it still doesn't work
here is my new code:
#import "THViewController.h"
@implementation THViewController
- (IBAction)buttonPressed:(id)sender {
}
@end
Chris Lopez
8,155 PointsChris Lopez
8,155 PointsTHANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU!!!!!!!!
It works!!