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 Relating Users in Parse.com Removing Friends by Tapping on a Table View Cell

Scott Fitsimones
Scott Fitsimones
2,609 Points

Why do we need to specify Indexpath.row in Obj-c?

seems pretty repetitive, what is the difference between that and regular indexpath?

PFUser *user = [self.allUsers objectAtIndex:indexPath.row];

1 Answer

Francisco Navarro
Francisco Navarro
14,185 Points

In tableviews we can have rows and sections. In the case of the app we have learned here we just have one section and a lot of rows represented as users in parse.com

indexPath (an instance of NSIndexPath) has two properties called row and section. As we need to know which user has been pushed in table view we have to specify the row. Maybe in the future when you have more users and you want to organize them by sections you will require the "section" property of indexPath instead.

Hope that helps