表视图单元格不从内存中释放

时间:2017-03-07 21:12:45

标签: swift3 tableviewcell

我希望一切顺利 我在表格视图中有一个问题,当我在表格视图中滚动时,它不会释放以下是我的代码

class MovieDownloadedTableViewCell: UITableViewCell {

    @IBOutlet weak var movieImageView: UIImageView!
    @IBOutlet weak var movieNameLabel: UILabel!
    @IBOutlet weak var movieEmptyCircleImageView: UIImageView!
    @IBOutlet weak var movieCheckMarkImageView: UIImageView!

    var fetchURL:URL? {
        didSet {
            updateUI()
        }
    }

    func updateUI() {

        movieImageView.image = nil
        movieNameLabel.text = nil
        movieEmptyCircleImageView.isHidden = true
        movieCheckMarkImageView.isHidden = true
        if let fetchURL = fetchURL {
            if fetchURL.pathExtension == "" {
               movieImageView.image = UIImage(named: "folder")
            }else{
               movieImageView.image = UIImage(named: "movie")
            }
            movieNameLabel.text = fetchURL.lastPathComponent

        }// end the if let

    }// end the func updateUI

}// end the class

以上我的自定义表格视图单元格

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

    let cell = tableView.dequeueReusableCell(withIdentifier: "Cell") as? MovieDownloadedTableViewCell

    // defining the cell
    if let cell = cell {
        cell.tintColor = UIColor.white
        cell.fetchURL = operationDocumentDirectoryObject.arrayOfMovieURL?[indexPath.row]

        if isShowToolBar {

        if operationDocumentDirectoryObject?.arrayOfShowAllEmptyCircle?[indexPath.row] == indexPath.row {
            cell.movieEmptyCircleImageView.isHidden = false
            }// end the if

            if operationDocumentDirectoryObject.dictionaryHoldIndexCellForDisplayWhichCellSelected.count > 0 {
                if operationDocumentDirectoryObject.dictionaryHoldIndexCellForDisplayWhichCellSelected[indexPath.row] == indexPath.row {
                    cell.movieEmptyCircleImageView.isHidden = true
                    cell.movieCheckMarkImageView.isHidden = false
                }
            }

        }// end if for the isShowVar

    }// end the creating cell

    return cell!
}

请在哪里我的错误代码当我滚动每次从内存中释放时我怎样才能使我的表格查看单元格

非常感谢

0 个答案:

没有答案