Selected UItableViewCell staying blue when selected

前端 未结 7 1890
醉话见心
醉话见心 2020-12-12 18:17

When I push a view after a user has selected a UITableView row, the row gets a blue highlight, and then the new view appears. That\'s fine. But when I go \'back\' the row is

相关标签:
7条回答
  • 2020-12-12 18:46

    If your controller is based on UITableViewController, you get this feature for free. But I often ended up using UIViewController with no. of other controls in addition to UITableView, in that case, you should override your viewWillAppear to

    -(void) viewWillAppear:(BOOL)animated{
        // Unselect the selected row if any
        NSIndexPath*    selection = [devListTableview indexPathForSelectedRow];
        if (selection){
            [tableview deselectRowAtIndexPath:selection animated:YES];
        }
    }
    
    0 讨论(0)
提交回复
热议问题