2010-06-24 19 views
0

我有一個帶有xib視圖的UIViewController,它有一個按鈕和一個表。 一切都已連線,數據中有行等。但如果我點擊一行並離開此初始屏幕,然後返回,表格中的單元格仍然具有突出顯示的狀態。 我是否需要實現除numberOfSectionsInTableView,tableView:cellForRowAtIndexPath和tableView:didSelectRowAtIndexPath之外的方法?在UIViewController中使用UITable

回答

1

實現您的視圖控制器上-viewWillAppear:並取消該表的當前選擇的行,像這樣:

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