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


Eilon Krauthammer
Eilon Krauthammer
4,768 Points

Help in extra credit of stage 3 in the "Ribbit" app

I've added the new fields for firstname, last name etc in the sign up screen and connected it in my project and with Parse, and I've set up a new view controller and set my labels to the keys associated with Parse, and made a segue from the friends table view controller to the new view controller. I just don't know how to make it that when I press on a specific cell with a user on it to show the specific information to that user. Help please? :)

2 Answers

you can set up PFUser property in the profile view controller

@property (nonatomic, strong) PFUser *selectedUser;

then in the FriendsViewController, you can do something like this:

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath

[self performSegueWithIdentifier:@“showProfile” sender:indexPath];

- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
    NSIndexPath *indexPath = (NSIndexPath *)sender;
PFUser *user = [self.friends objectAtIndex:indexPath.row];

 ProfileViewController *pViewController = (ProfileViewController *)segue.destinationViewController;
        pViewController.selectedUser = user;


in the ProfileViewController you can access the selectedUser's details by doing something like this NSString *nameString = [self.selectedUser objectForKey:@"name"];

hope that helps

Rutger Farry
Rutger Farry
10,722 Points

Implement the delegate method tableView:didSelectRowAtIndexPath: in the FriendsViewController. Assuming you created a segue with identifier "showProfile", your code might look something like this:

- (void)tableView:(UITableView *)tableView 
didDeselectRowAtIndexPath:(NSIndexPath *)indexPath
        [self performSegueWithIdentifier:@"showProfile" sender:self];

Then in your ProfileViewController.m, you will need to make sure it knows which profile to load in the viewDidLoad method