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

Spencer Fornaciari
Spencer Fornaciari
7,780 Points

Now switch to LoginViewController.m.

So I'm on the the code challenge for "Adding Friends by Tapping on a Table View Cell" which asks:

"In this Code Challenge we are working on an app to download videos of the Treehouse Show, which are listed in a table view. Create a list of shows to download by adding the code below to mark rows as selected or not using 'UITableViewCellAccessoryCheckmark' and 'UITableViewCellAccessoryNone'."

For my code I'm thinking it will need to be something like this (since we're just following the adding stage:

if (cell.accessoryType == UITableViewCellAccessoryNone) {

}
else {
   PFRelation *moviesRelation = [self.currentUser relationForKey:@"moviesRelation"];
   PFUser *user = [self.allUsers objectAtIndeX:indexPath.row];
   [moviesrelation addObject:user];
   [self.currentUser saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
     }];
}

Any suggestions?

5 Answers

Yes is it me or Ben's code challenges are very hard to understand compared to Amit's ?

David Kaneshiro Jr.
David Kaneshiro Jr.
29,247 Points

Spencer Fornaciari,

This challenged stumped me too. I had to read the challenge description a few times before it clicked. And the answer turned out to be not very complicated.

The key phrase in the description is, mark rows as selected or not using 'UITableViewCellAccessoryCheckmark' and 'UITableViewCellAccessoryNone'. All the challenge wants you to do is set the cell.accessoryType property to be either 'UITableViewCellAccessoryCheckmark' or 'UITableViewCellAccessoryNone'. Based on whether or not it met the condition in the 'if' statement.

if (cell.accessoryType == UITableViewCellAccessoryNone) {   
cell.accessoryType = UITableViewCellAccessoryCheckmark;
}
else {
    cell.accessoryType = UITableViewCellAccessoryNone;
}
Spencer Fornaciari
Spencer Fornaciari
7,780 Points

Ah gotcha, basically just testing to see if the video already been checked, and if not then check it.

That makes a lot more sense, thanks for breaking that down.

Ashley Dunbabin
Ashley Dunbabin
17,041 Points

Thanks for the help with this challenge. I am really enjoying Treehouse, however, I do find the challenge questions a lot of the time quite ambiguous and confusing. I might just need to break the questions down a little more!

Cheers - Ash

Yes is it me or Ben's code challenges are very hard to understand compared to Amit's ?

Ashley Dunbabin
Ashley Dunbabin
17,041 Points

I guess it is hard to write questions that everyone can understand considering that programming has its own unique language / lingo. Whoever writes the questions has to take into consideration that a lot of people come from different language backgrounds as well as different English speaking countries and cultures as well.

I think on the whole they do a good job with the questions (otherwise we wouldn't pay our monthly subscription), but sometimes it can be frustrating if you can understand what the question is asking you to do, but I am getting the hang of it.

I just want my next badge :-)