Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@ final class JobCardCell: UICollectionViewCell {
}

private let jobCardCoverImage = UIImageView().then {
$0.image = UIImage(resource: .icHome)
$0.contentMode = .scaleAspectFit
}

Expand Down Expand Up @@ -87,6 +86,12 @@ final class JobCardCell: UICollectionViewCell {
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func prepareForReuse() {
super.prepareForReuse()

self.jobCardCoverImage.image = UIImage(resource: .imgPostPlaceHolder)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

이러면 이제 이미지 밀리는거 해결 되나요?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prepareForReuse() 호출할 때, 기본값을 넣어주면 해결되더라고요!
더 좋은 방법이 있는지는 공부하면서 알아봐야 할 것 같습니다.

}
}

// MARK: - UI & Layout
Expand Down Expand Up @@ -166,7 +171,7 @@ extension JobCardCell {
}

self.internshipAnnouncementId = model.internshipAnnouncementId
self.jobCardCoverImage.setImage(with: model.companyImage, placeholder: "placeholder_image")
self.jobCardCoverImage.setImage(with: model.companyImage, placeholder: "img_post_placeHolder")
self.daysRemaining.text = model.dDay
self.jobLabel.text = model.title
self.period.text = model.workingPeriod
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import UIKit

import SnapKit
import Then

final class CompanyInfoTableViewCell: UITableViewCell {

Expand Down Expand Up @@ -83,7 +84,7 @@ extension CompanyInfoTableViewCell {

extension CompanyInfoTableViewCell {
func bind(with companyInfo: CompanyInfoModel) {
companyImageView.setImage(with: companyInfo.companyImage ?? "placeholder_image", placeholder: "placeholder_image")
companyImageView.setImage(with: companyInfo.companyImage ?? "placeholder_image", placeholder: "img_post_placeHolder")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

companyInfo.companyImage 값이 없을때도 "placeholder_image"말고 "img_post_placeHolder" 써도 되지 않을까요??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

값이 없을 때 <- 빈 이미지
값이 뜨기 전 <- 플레이 홀 더 이미지

이렇게 분리해서 생각을 했는데, 통일할지는 디자인 선생님들에게 물어봐야 할 것 같네요!

companyNameLabel.text = companyInfo.company
companyTypeLabel.text = companyInfo.companyCategory
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
{
"images" : [
{
"filename" : "jobPost_placeHolder.svg",
"idiom" : "universal",
"scale" : "1x"
},
{
"idiom" : "universal",
"scale" : "2x"
},
{
"idiom" : "universal",
"scale" : "3x"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 2 additions & 3 deletions Terning-iOS/Terning-iOS/Resource/Utils/setImage.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,11 @@ public extension UIImageView {
private func setNewImage(with urlString: String, placeholder: String? = "img_placeholder", completion: ((UIImage?) -> Void)? = nil) {
guard let url = URL(string: urlString) else { return }
let resource = Kingfisher.KF.ImageResource(downloadURL: url, cacheKey: urlString)
let placeholderImage = UIImage(named: "img_placeholder")
let placeholder = placeholderImage
let placeholderImage = UIImage(named: placeholder ?? "img_placeholder")

self.kf.setImage(
with: resource,
placeholder: placeholder,
placeholder: placeholderImage,
options: [
.scaleFactor(UIScreen.main.scale/4),
.transition(.fade(0.5)),
Expand Down