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 Capturing Photo and Video Using UIImagePickerController Adding Recipients

deselectRow dont work in cameraviewcontroller

Hi guys,

today ive been busy with adding recipients as 4th stage of self destructing app, ive developing it in ios 7 while the tutorials is recorded in ios6.2 or something.

Ive this in cameraviewcontroller.m (see between lines). When I launch the app, choose camera, select image, and when I choose recipients the deselection wont work, why? I couldnt figure out while the deselection code is included...

thanks sinan


-(void)tableView:(UITableView *)tableView didDeselectRowAtIndexPath:(NSIndexPath *)indexPath { [self.tableView deselectRowAtIndexPath:indexPath animated:YES];

UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
PFUser *user = [self.friends objectAtIndex:indexPath.row];
//////


if (cell.accessoryType == UITableViewCellAccessoryNone) {
    cell.accessoryType = UITableViewCellAccessoryCheckmark;
    [self.recipients addObject:user.objectId];

}
else {
    cell.accessoryType = UITableViewCellAccessoryNone;
    [self.recipients removeObject:user.objectId];
}

}


2 Answers

I couldn't understand your question, but the solution to your problem is probably changing didDeselectRowAtIndexPath to didSelectRowAtIndexPath.

i meant that when I select a cell in the tableview, it remained selected.

Now with your advice i solved that, thanks I didnt see it.