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 Self-Destructing Message iPhone App Designing and Starting the App Adding Login and Sign Up Screens

Troy Fine
Troy Fine
7,592 Points

Stuck on Code Challenge

Task 1 of 2:

"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."

Everything I'm trying isn't working. Any help is appreciated.

7 Answers

The addSong method should be like this:

[self performSegueWithIdentifier:@"showAddSong" sender:self];

first you reference yourself, then you call the performSegueWithIdentifier method, tells what the identifier is and set the sender. There you go.

Stone Preston
Stone Preston
42,016 Points

the challenge asks you to define the method. so all you have to do is

- (void)addSong {

}

just below the viewDidLoad

J Kim
J Kim
15,218 Points

Some of these questions really need to worded better. It really bugs me that time is being wasted because of these non-specific directions.

J Kim
J Kim
15,218 Points

Honestly sometimes it seems to be better to not have a question than to have a bad one. Some of these questions on the site sometimes are vague, misleading, and sometimes down right wrong. I like the fact that there are variety of ways of enforcing what we've learned, but having some quiz because it's just the part of the format feels really counter-intuitive at times.

Troy Fine
Troy Fine
7,592 Points

That makes sense, thanks a lot.

Troy Fine
Troy Fine
7,592 Points

Cool, not sure why but I'm still lost when it comes to segues.

Got stuck again on second part of this challenge...
Here is my code for it.

-(void)addSong { [segue:showAddSong destinationViewController]; }

Tried other methods but I still can't figure it out.

Honestly I got stuck on this challenge more because of the ambiguity of the question and not the actual coding. Fixed it now though :).