2017-05-05 13 views
1

我想知道當前所選行在上一行所選行的didDeselectRowAt行的人。我試圖使用「tableView.indexPathsForSelectedRows」,但它返回零。我認爲,因爲表格視圖在調用didDeselectRowAt基金時取消選擇之前選定的行。我想知道如何訪問行表視圖存儲以調用在之前所選行的didDeselectRowAt之後選擇的行的didSelectRowAt。
任何人都可以幫助我。我用swift 3.
非常感謝。如何知道前一個選定行的didDeselectRow的下一個選定行的IndexPath?

+1

什麼你試過還提供代碼這裏。 –

回答

1

你需要採取兩種變種性質

var currentIndexSelected : Int 
var previousIndexSelected : Int 

當用戶在didSelect點擊分配

currentIndexSelected = indexPath.row 

,當用戶在didDeselect點擊分配

previousIndexSelected = currentIndexSelected 
相關問題