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 trialhunche
3,339 PointsChallenge task 1 of 2In the view controller below about songs, tapping on a button to add a new song needs to perform
In the view controller below about songs, tapping on a button to add a new song needs to perform a segue to another view controller. The button is wired up to an IBAction with the signature '- (void)addSong'. Start by defining this method.
import "MusicViewController.h"
@implementation MusicViewController
- (void)viewDidLoad { [super viewDidLoad]; [self addSong]; // I add this line to add a song
}
@end
I can not recognize two things 1)The button is wired up to an IBAction with the signature '- (void)addSong'. 2)Start by defining this method.
How should I go to think of them
3 Answers
Mohammad Baqer
4,260 Points1)The button is wired up to an IBAction with the signature '- (void)addSong'.
it means that he connected a Button (when touched) to the code using assistant editor (tuxedo guy) and name it "addSong"
2)Start by defining this method
it means you should put the method "- (void)addSong" in the implementation file
hunche
3,339 PointsI wrote my answer as below ,but no work
- (IBAction)addSong:(UIButton *)sender { }
Mohammad Baqer
4,260 PointsThe methods in .h file must be exactly as the methods on the .m file
So all you have to do is copy the method to the implantation file
Write -(void)addSong{}