Skip to content

Commit

Permalink
Merge pull request #40 from SOPT-33-iOS-Team-1/Style/#34
Browse files Browse the repository at this point in the history
[Style] #34- Card 레이아웃 설정
  • Loading branch information
bangMinjI98 authored Nov 25, 2023
2 parents 33f00b1 + 7853c48 commit 4876042
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ public enum Image {
static let ellipse3 = UIImage(named: "Ellipse 33-2")
static let star1 = UIImage(named: "ic_card2")
static let star2 = UIImage(named: "ic_card3")
static let star3 = UIImage(named: "_ic_card1")
static let card = UIImage(named: "img_card")
static let background = UIImage(named: "img_mainbackground")
static let profileCard = UIImage(named: "img_profile")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import UIKit

class GelationCollectionViewCell: UICollectionViewCell {

private var backgroundImage = UIView()
private var backgroundImage = UIImageView()
private var cardTitle = UILabel()
private var cardIcon = UIImage()
private var cardIcon1 = UIImage()
private var cardIcon2 = UIImage()
private var cardIcon3 = UIImage()
private var list1 = UILabel()
private var list2 = UILabel()
private var list3 = UILabel()
Expand All @@ -33,7 +35,6 @@ class GelationCollectionViewCell: UICollectionViewCell {
}

func bindData(data: GelationData) {
self.backgroundImage = data.backgroundImage
self.cardTitle.text = data.cardTitle
self.list1.text = data.list1
self.list2.text = data.list2
Expand All @@ -53,35 +54,35 @@ class GelationCollectionViewCell: UICollectionViewCell {
}

cardTitle.snp.makeConstraints {
$0.leading.equalTo(backgroundImage.snp.leading).inset(23.adjusted)
$0.top.equalTo(backgroundImage.snp.top).inset(85.adjusted)
$0.leading.equalTo(backgroundImage.snp.leading).inset(25.adjusted)
$0.top.equalTo(backgroundImage.snp.top).inset(99.adjusted)
$0.width.equalTo(50)
}

list1.snp.makeConstraints {
$0.leading.equalToSuperview().inset(150.adjusted)
$0.leading.equalToSuperview().inset(118.adjusted)
$0.top.equalToSuperview().inset(20.adjusted)
}

list2.snp.makeConstraints {
$0.leading.equalToSuperview().inset(150.adjusted)
$0.leading.equalToSuperview().inset(118.adjusted)
$0.top.equalToSuperview().inset(47.adjusted)
}

list3.snp.makeConstraints {
$0.leading.equalToSuperview().inset(150.adjusted)
$0.leading.equalToSuperview().inset(118.adjusted)
$0.top.equalToSuperview().inset(74.adjusted)
}

list4.snp.makeConstraints {
$0.leading.equalToSuperview().inset(150.adjusted)
$0.leading.equalToSuperview().inset(118.adjusted)
$0.top.equalToSuperview().inset(101.adjusted)
}

backgroundImage.do {
$0.frame = CGRect(x: 0, y: 0, width: 335.adjusted, height: 205.adjusted)
$0.backgroundColor = .white
$0.makeCornerRound(radius: 10)
$0.image = Image.card
}

cardTitle.do {
Expand All @@ -92,18 +93,22 @@ class GelationCollectionViewCell: UICollectionViewCell {

list1.do {
$0.font = UIFont(name: "Pretendard-SemiBold", size: 14.adjusted)
$0.textColor = .white
}

list2.do {
$0.font = UIFont(name: "Pretendard-SemiBold", size: 14.adjusted)
$0.textColor = .white
}

list3.do {
$0.font = UIFont(name: "Pretendard-SemiBold", size: 14.adjusted)
$0.textColor = .white
}

list4.do {
$0.font = UIFont(name: "Pretendard-SemiBold", size: 14.adjusted)
$0.textColor = .white
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,6 @@ import SnapKit

class CustomGelationNavigationView: UIView {

private let gelationViewbackButton: UIButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(systemName: "chevron.backward"), for: .normal)
button.tintColor = .white
return button
}()

private let gelationViewTitle: UILabel = {
let label = UILabel()
label.text = "교화 활동"
Expand Down Expand Up @@ -45,20 +38,15 @@ class CustomGelationNavigationView: UIView {

private func setLayout() {

addSubviews(gelationViewbackButton, gelationViewTitle)
addSubviews(gelationViewTitle)

self.snp.makeConstraints {
$0.height.equalTo(52)
}

gelationViewbackButton.snp.makeConstraints {
$0.top.equalToSuperview()
$0.leading.equalToSuperview().inset(21)
}

gelationViewTitle.snp.makeConstraints {
$0.top.equalToSuperview()
$0.leading.equalTo(gelationViewbackButton.snp.trailing).offset(10)
$0.leading.equalToSuperview().inset(52)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,25 +22,43 @@ final class GelationDetailView: UIViewController {
setCollectionViewLayout()
}

@objc func handleListTap() {
navigationController?.popViewController(animated: true)
}

private func setStyle() {
self.navigationController?.navigationBar.isHidden = true
gelationViewbackButton.addTarget(self, action: #selector(handleListTap), for: .touchUpInside)
}

private func setLayout() {
self.view.addSubviews(collectionView, customGelationNavigationView)
customGelationNavigationView.addSubview(gelationViewbackButton)

customGelationNavigationView.snp.makeConstraints {
$0.top.equalTo(view.safeAreaLayoutGuide)
$0.horizontalEdges.equalToSuperview()
}

gelationViewbackButton.snp.makeConstraints {
$0.top.equalToSuperview()
$0.leading.equalToSuperview().inset(21)
}

collectionView.snp.makeConstraints{
$0.bottom.leading.trailing.equalToSuperview()
$0.top.equalTo(customGelationNavigationView.snp.bottom)
}

}

private let gelationViewbackButton: UIButton = {
let button = UIButton(type: .custom)
button.setImage(UIImage(systemName: "chevron.backward"), for: .normal)
button.tintColor = .white
return button
}()

private let collectionView = UICollectionView(frame: .zero, collectionViewLayout: UICollectionViewFlowLayout()).then {
$0.backgroundColor = .black
}
Expand All @@ -52,6 +70,7 @@ final class GelationDetailView: UIViewController {
self.collectionView.dataSource = self
}


private func setCollectionViewLayout() {
let flowLayout = UICollectionViewFlowLayout()
flowLayout.itemSize = CGSize(width: 335, height: 205)
Expand Down

0 comments on commit 4876042

Please sign in to comment.