Swift3 在自定义表视图单元格中使用dequeueReusableCell泄漏内存

Swift3 在自定义表视图单元格中使用dequeueReusableCell泄漏内存,swift3,tableview,Swift3,Tableview,我在table view单元格中的dequeueReusableCell存在问题每次我在tableView中滚动时,我在使用Xcode中的instruments工具时都会出现内存泄漏。请显示此函数中的泄漏我如何解决此问题请帮助我解决此问题 func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { let cell = tableView

我在table view单元格中的dequeueReusableCell存在问题每次我在tableView中滚动时,我在使用Xcode中的instruments工具时都会出现内存泄漏。请显示此函数中的泄漏我如何解决此问题请帮助我解决此问题

func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell {


        let cell = tableView.dequeueReusableCell(withIdentifier: "MovieCell") as! MovieTableViewCell

        // her for the button delete in cell
        // add target
        cell.changeFolderNameButton.tag = indexPath.row
        cell.changeFolderNameButton.addTarget(self, action: #selector(self.changeFolderName(sender:)), for: .touchUpInside)
        /////////////
        cell.imageViewCheckMark.isHidden = true
        cell.imageViewSelect.isHidden = true

        let getFile = ARRAYOFFOLDERS[indexPath.row]

        // for display the URL for each folder in the documents
        cell.URLFolderLabel.text = ARRAYOFFOLDERS[indexPath.row].absoluteString

        if getFile.pathExtension == "" {
            cell.imageViewCell.image = UIImage(named: "folder")
            cell.folderNameLabel.text = getFile.lastPathComponent
        }else{
            cell.imageViewCell.image = UIImage(named: "movie")
            cell.folderNameLabel.text = getFile.lastPathComponent
        }


        if ARRAY_HOLD_ALL_CELL_WITH_EMPTY_CIRCLE.count > 0 && STATUS_EDIT_BUTTON {
            // for show all the empty circle near to folder
            if ARRAY_HOLD_ALL_CELL_WITH_EMPTY_CIRCLE[indexPath.row] == indexPath.row {
                cell.imageViewSelect.isHidden = false
                cell.imageViewCheckMark.isHidden = true
            }
        }else if STATUS_EDIT_BUTTON == false && ARRAY_HOLD_ALL_CELL_WITH_EMPTY_CIRCLE.count > 0 {
            if ARRAY_HOLD_ALL_CELL_WITH_EMPTY_CIRCLE[indexPath.row] == indexPath.row {
                cell.imageViewSelect.isHidden = true
                cell.imageViewCheckMark.isHidden = true
            }
        }

        // for show the checkmark on the cell which user select it
        if STATUS_EDIT_BUTTON && DICTIONARY_OF_SELECT_FILE.count > 0 {
            if DICTIONARY_OF_SELECT_FILE[indexPath.row] == indexPath.row {
                cell.imageViewCheckMark.isHidden = false
                cell.imageViewSelect.isHidden = true
            }
        }else if STATUS_EDIT_BUTTON == false && DICTIONARY_OF_SELECT_FILE.count > 0 {
            if DICTIONARY_OF_SELECT_FILE[indexPath.row] == indexPath.row {
                cell.imageViewSelect.isHidden = true
                cell.imageViewCheckMark.isHidden = true
            }
        }
        ////////////////

        return cell

    }

非常感谢

可能不是原因,但您使用的是旧的出列签名。您应该使用
let cell=tableView.dequeueReusableCell(带有标识符:“MovieCell”,for:indexPath)作为!MovieTableViewCell
instead@AshleyMills我不知道。我刚才问了一个问题,如果你知道更多,你能回答吗?我也不知道如何解决它可能不是原因,但你使用的是旧的出列签名。您应该使用
let cell=tableView.dequeueReusableCell(带有标识符:“MovieCell”,for:indexPath)作为!MovieTableViewCell
instead@AshleyMills我不知道。我刚才问了一个问题,如果你对它了解更多,你能回答吗?我也不知道我该怎么解决它