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
Andrej Kirin
18,967 PointsiOS Development
I am having problems with this assignement here:
We are working on an app to download videos of the Treehouse Show, which are listed in a table view. The user will tap on items in the list to create a list of shows to download. For each tap, add code below to simply mark rows as selected or not using 'UITableViewCellAccessoryCheckmark' and 'UITableViewCellAccessoryNone'.
This is one code challenge form creating a self-destructing message iPhone app. I'm stuck here, could anyone explain this or provide me with correct answer.
Thanks!
3 Answers
Andres Mauricio Guerrero
4,111 Pointswell, I´m going to try to help you by giving as little to no code as possible, you have this "if" condition:
if (cell.accessoryType == UITableViewCellAccessoryNone) {
}
else {
}
first know what´s being asked, then understand your if condition, if for each tap you want to mark your row as checked or unchecked then you could see that your'e doing opposite tasks here, so knowing that, the you go to the "if" condition.
this condition what is telling us in our human language is "if the cell that we touched has nothing on it (in this case unchecked), then do... else, do the opposite thing" so what do we want to do if the cell is unchecked? and what do we want to do if the cell is checked (else statement)? hope this helps you, let me know ;)
cheers and keep coding! ;)
Rahel Haque
Courses Plus Student 2,755 PointsExcellent comment! Just need to keep in mind the binary logic flow!!
Dekel Zoaretz
14,864 PointsThank you very much! it was very helpful :)
Jonathan Fernandez
8,325 PointsJonathan Fernandez
8,325 PointsThanks for this comment. Helped me out as well. : )
Andres Mauricio Guerrero
4,111 PointsAndres Mauricio Guerrero
4,111 Pointsno problem Jonathan, thats one way I was taught to understand coding and all of that stuff... :)