开发者

Using a UITable in a UIViewController

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜