Skip to content

Commit

Permalink
[Add] #15 - 카세티 gif 추가
Browse files Browse the repository at this point in the history
  • Loading branch information
513sojin committed Apr 8, 2023
1 parent 0ec3e58 commit 46f0c6b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 7 deletions.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified Cassetie/Cassetie-iOS/Resource/Gif/cassetie-fourth.gif
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import UIKit

import SnapKit
import Then
import Gifu

enum QuestionType: CaseIterable {
case first
Expand Down Expand Up @@ -58,8 +59,19 @@ enum QuestionType: CaseIterable {
}
}

var image: UIImage {
return Image.testCassetieImage
var gifImage: String {
switch self {
case .first:
return "cassetie-first"
case .second:
return "cassetie-second"
case .third:
return "cassetie-third"
case .fourth:
return "cassetie-fourth"
case .fivth:
return "cassetie-fivth"
}
}
}

Expand All @@ -72,12 +84,14 @@ class AskQuestionCollectionViewCell: BaseCollectionViewCell {
$0.numberOfLines = 0
}

var cassetieImage = UIImageView()
var cassetieGifImageView = GIFImageView().then {
$0.contentMode = .scaleToFill
}

override func setupLayout() {
super.setupLayout()

cassetieImage.snp.makeConstraints {
cassetieGifImageView.snp.makeConstraints {
// $0.leading.trailing.equalToSuperview().inset(50)
$0.top.equalToSuperview().offset(15)
$0.width.equalTo(334.adjustedWidth)
Expand All @@ -86,15 +100,15 @@ class AskQuestionCollectionViewCell: BaseCollectionViewCell {
}

questionLabel.snp.makeConstraints {
$0.top.equalTo(cassetieImage.snp.bottom).offset(17.adjustedHeight)
$0.top.equalTo(cassetieGifImageView.snp.bottom).offset(17.adjustedHeight)
$0.centerX.equalToSuperview()
}
}

override func setupHierarchy() {
super.setupHierarchy()

contentView.addSubviews([cassetieImage, questionLabel])
contentView.addSubviews([cassetieGifImageView, questionLabel])
}

func configure(_ type: QuestionType) {
Expand All @@ -110,6 +124,6 @@ class AskQuestionCollectionViewCell: BaseCollectionViewCell {
.regular(string: type.thirdText, fontSize: 28)
}

cassetieImage.image = type.image
cassetieGifImageView.animate(withGIFNamed: type.gifImage)
}
}

0 comments on commit 46f0c6b

Please sign in to comment.