views:

617

answers:

3

This bit of code comes with new classes that are subclasses of UITableViewController...

- (void)viewDidLoad {
    [super viewDidLoad];

    // Uncomment the following line to preserve selection between presentations.
    self.clearsSelectionOnViewWillAppear = NO;

    // Uncomment the following line to display an Edit button in the navigation bar for this view controller.
    // self.navigationItem.rightBarButtonItem = self.editButtonItem;
}

But leaving the clearsSelectionOnViewWillAppear uncommented throws a compile error. The error is "request for member 'clearsSelectionOnViewWillAppear' in something not a structure or union". Any ideas as to why or do you have a workaround?

The reason I even care is because without this bit, my app is leaving the selection indicator (blue background) on my table cells.

+2  A: 

Are you compiling for 3.1.3 (or earlier) or 3.2? clearsSelectionOnViewWillAppear is a property available in the 3.2 and newer SDK.

Giao
Aha! Thank you. Yes, compiling for 3.1.3. So, how do I clear the selection in 3.1.3 if that's only available in 3.2?
E-Madd
Typing this without trying it `[self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:NO];`.
Giao
A: 

Hey, where do I put this code ???

Denis
This isn't an answer
Noah Witherspoon
A: 

at viewDidAppear

Carlos