2012-08-09 49 views

回答

3

tableView:didDeselectRowAtIndexPath:未在UITableViewController子類中的viewWillAppear:上自動取消選中單元時調用。

使用下面的代碼,以使在這種情況下取​​消更改:

- (void) viewWillAppear:(BOOL)animated { 
    // HACK: Need to be called before super if the selection is cleared on viewWillAppear. 
    UITableViewCell* cell = [self.tableView cellForRowAtIndexPath:self.tableView.indexPathForSelectedRow]; 
    // Change the cell 
    [super viewWillAppear:animated]; 
} 

在一般情況下,如果使用deselectRowAtIndexPath:animated:tableView:didDeselectRowAtIndexPath:不會被調用。

相關問題