deselectRowAtIndexPath not getting called

I have a UITableview in a popover. I cannot seem to get the deselection to animate or work at all. The checkmark stays there on the previous selected row (the checkmark is set from my Model class which is just an NSDictionary, where one value is @"YES", and all other values are @"NO." When I close the popover, and reopen it, the checkmark is correct, but I cannot seem to get it while the popover is open. Thoughts? Thanks.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
     NSUInteger row = [indexPath row];
        UITableViewCell *cell = [tableView cellForRowAtIndexPath:indexPath];
        cell.selectionStyle = UITableViewCellSelectionStyleNone;
        cell.accessoryType = UITableViewCellAccessoryCheckmark;
//        [cell setSelected:YES animated:YES];   
        [tableView deselectRowAtIndexPath:indexPath animated:YES];
}

Answers


deselectRowAtIndexPath does not remove the accessoryView of the UITableViewCell, it removes the highlighted (blue) background of the UITableViewCell. The following code sets the check mark of a cell:

cell.accessoryType = UITableViewCellAccessoryCheckmark;

To remove the checkmark from that cell, you have to do:

cell.accessoryType = UITableViewCellAccessoryNone;


Need Your Help

Why do I get a conversion error when calling this from outside my class?

.net generics c++-cli

I have a class I'm trying to write some unit tests for but I've getting conversion errors:

Order of sheets in Excel file while reading with GetOleDbSchemaTable

c# excel oledbconnection

I am using an ACE.OLEDB as below to read an excel file in C#.

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.