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 trialQuandra McGrue
488 PointsIBAction Challenge
In a challenge for the "build an iPhone app" course, I'm being asked to "define a method called 'buttonPressed' and make sure it returns an 'IBAction'".
So, I typed the following: (IBAction) buttonPressed; and NSLong(@ "Button Pressed");
I think I put some curly braces in there too.
It didn't work. My error message just restated the directions. I'm not sure which part of what I just learned and practiced needs to be typed into the challenge box.
Thanks to anyone who takes time to help me.
2 Answers
Stone Preston
42,016 Pointsyou were very close with your first answer. the challenge just wants you to define an empty method called buttonPressed that returns an IBAction. remember that instance method signatures start with a dash
#import "THViewController.h"
@implementation THViewController
// Add your code below
- (IBAction)buttonPressed {
}
@end
``
Quandra McGrue
488 PointsThanks Shawn and Stone! I really appreciate your taking the time to answer.
Shawn McGrory
546 PointsShawn McGrory
546 PointsTry NSLog(@"Button Pressed"); instead of 'NSLong'!
At least Xcode catches typos!