0
請我有與標識符表視圖didSelectRow方法執行賽格瑞每個i抽頭單元時間的記憶增加泄漏存儲器與performSegue與標識符迅速3
以下內容的問題是我的代碼:
func tableView(_ tableView: UITableView, didSelectRowAt indexPath: IndexPath) {
// firstly i need to check if edit button is true so i can select cell
if isShowToolBar {
// her for hold selected index
let cell = tableView.cellForRow(at: indexPath) as? MovieDownloadedTableViewCell
if let cell = cell {
cell.movieCheckMarkImageView.isHidden = false
cell.movieEmptyCircleImageView.isHidden = true
operationDocumentDirectoryObject.dictionaryHoldIndexCellForDisplayWhichCellSelected.updateValue(indexPath.row, forKey: indexPath.row)
// start hold URL
operationDocumentDirectoryObject.dictionaryForHoldURLSelected.updateValue(operationDocumentDirectoryObject.arrayOfMovieURL![indexPath.row], forKey: indexPath.row)
}// end the if let cell
}else{
// her for show the content folder
let cell = tableView.cellForRow(at: indexPath) as? MovieDownloadedTableViewCell
if let cell = cell {
if cell.fetchURL!.pathExtension == "" {
performSegue(withIdentifier: "ShowFolder", sender: indexPath.row)
}else{
// playing the video
performSegue(withIdentifier: "PlayingMovie", sender: cell.fetchURL!.lastPathComponent)
}// end the if for check path extenstion
}// end the if let cell
cell = nil
}// end the if for the isShowToolbar
}
上述方法具有內存泄漏在執行賽格瑞和引起與增加存儲器(如果cell.fetchURL!.pathExtension ==「」)還使存儲器泄漏
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
if segue.identifier == "MoveFile" {
if let destination = segue.destination as? MoveMovieViewController {
destination.operationDocumentDirectoryObject.dictionaryForHoldURLSelected = self.operationDocumentDirectoryObject.dictionaryForHoldURLSelected
}
}else if segue.identifier == "ShowFolder" {
if let destination = segue.destination as? ShowContentFolderMovieViewController {
if let fetchIndex = sender as? Int {
destination.operationDocumentDirectory.folderName = self.operationDocumentDirectoryObject.arrayOfMovieURL![fetchIndex].lastPathComponent
}
}
}else if segue.identifier == "PlayingMovie" {
// make an object for the playing video view controller
if let destination = segue.destination as? PlayingMovieViewController {
if let movieName = sender as? String {
destination.operationDocumentDirectory.movieName = movieName
}
}
}// end the condition for the segue
}
雖然DEINIT是在視圖控制器呼叫成功,但我還有泄漏並提高內存
什麼是我的錯誤代碼,請幫助?
非常感謝你
你的意思是我的segue是這樣,是正確的,我必須尋找另一種方法嗎?當我使用儀器工具它是執行segue它指向它需要4.45 mib我不知道爲什麼,我必須釋放所有意見deinit? – Mustafa
視圖控制器的所有deinit方法都調用成功,但正如我告訴你的,當我在儀器工具中檢查它時,它指向我的performSegue帶標識符它需要4.45 mib – Mustafa
您能張貼儀器工具的屏幕截圖向你展示? – hvasam