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 Simple iPhone App (iOS7) Getting Started Assign String to a Label

Chris Lopez
Chris Lopez
8,155 Points

Huh???

The instructions are very vague. this is my code

  • (IBAction)button:(id)sender {

}

3 Answers

Christian,

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

Chris Lopez
Chris Lopez
8,155 Points

THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU THANK YOU!!!!!!!!

It works!!

Christian,

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
Chris Lopez
8,155 Points

ok, thanks!

but it still doesn't work

here is my new code:

#import "THViewController.h"

@implementation THViewController

- (IBAction)buttonPressed:(id)sender {


}
@end