开发者

Using a UITable in a UIViewController

开发者 https://www.devze.com 2023-01-04 12:29 出处:网络
I\'ve got a UIViewController with a xib view that has a button and a table. Everything is wired up, the data has rows in it etc. But if i click a row and navigate away from this initial screen, then g

I've got a UIViewController with a xib view that has a button and a table. Everything is wired up, the data has rows in it etc. But if i click a row and navigate away from this initial screen, then go bac开发者_开发百科k, the cell in the table still has the highlighted state on it. Do i need to implement methods other than numberOfSectionsInTableView, tableView:cellForRowAtIndexPath and tableView:didSelectRowAtIndexPath?


Implement -viewWillAppear: on your view controller and deselect the table's currently-selected row, something like this:

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self.tableView deselectRowAtIndexPath:[self.tableView indexPathForSelectedRow] animated:animated];
}
0

精彩评论

暂无评论...
验证码 换一张
取 消