반응형
prepareForReuse()
https://developer.apple.com/documentation/uikit/uitableviewcell/1623223-prepareforreuse
설명이 잘되어있는 사이트
https://medium.com/ios-seminar/why-we-use-dequeuereusablecellwithidentifier-ce7fd97cde8e
class BestTableViewCell: UITableViewCell { // MARK: - Instance Vars @IBOutlet weak var mainStackView: UIStackView! @IBOutlet weak var titleLabel: UILabel! @IBOutlet weak var mainImageView: UIImageView! @IBOutlet weak var bodyLabel: UILabel! // MARK: - View Lifecycle override func awakeFromNib() { super.awakeFromNib() styleSetup() } override func prepareForReuse() { super.prepareForReuse() mainImageView.af_cancelImageRequest() // NOTE: - Using AlamofireImage mainImageView.image = nil } } // MARK: - Setup extension BestTableViewCell { func styleSetup() { mainImageView.layer.borderWidth = 0.5 mainImageView.layer.borderColor = UIColor.lightGray.cgColor } }
override func prepareForReuse() {
mainImageView.af_cancelImageRequest()
mainImageView.image = nil
}
반응형
'모바일 > IOS' 카테고리의 다른 글
TableCell 선택시 페이지 이동 Segue (0) | 2018.01.17 |
---|---|
ios App Icon 사이즈 (0) | 2018.01.17 |
The resource could not be loaded because the App Transport Security policy requires the use of a secure connection (0) | 2018.01.11 |
HTTP 통신 , JSON 처리 (0) | 2018.01.11 |
키보드관련 (0) | 2018.01.11 |