-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
210 additions
and
1 deletion.
There are no files selected for viewing
70 changes: 70 additions & 0 deletions
70
CheoMooRac/CheoMooRac/Sources/Cells/MyCardTableViewCell.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
// | ||
// MyCardTableViewCell.swift | ||
// CheoMooRac | ||
// | ||
// Created by 김윤서 on 2021/09/14. | ||
// | ||
|
||
import UIKit | ||
|
||
class MyCardTableViewCell: UITableViewCell, Reusable { | ||
|
||
private let profileImageView = UIImageView().then { | ||
$0.clipsToBounds = true | ||
$0.backgroundColor = .yellow | ||
} | ||
|
||
private let nameLabel = UILabel().then { | ||
$0.text = "김윤서" | ||
$0.font = .boldSystemFont(ofSize: 15) | ||
} | ||
|
||
private let discriptionLabel = UILabel().then { | ||
$0.text = "내 카드" | ||
$0.font = .systemFont(ofSize: 10) | ||
$0.textColor = .lightGray | ||
} | ||
|
||
private let vStackView = UIStackView().then { | ||
$0.axis = .vertical | ||
$0.alignment = .leading | ||
$0.spacing = 4 | ||
} | ||
|
||
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { | ||
super.init(style: style, reuseIdentifier: reuseIdentifier) | ||
setLayouts() | ||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError("init(coder:) has not been implemented") | ||
} | ||
|
||
private func setLayouts() { | ||
setViewHierarchy() | ||
setConstraints() | ||
} | ||
|
||
private func setViewHierarchy() { | ||
contentView.addSubviews(profileImageView, vStackView) | ||
vStackView.addArrangedSubviews(nameLabel,discriptionLabel) | ||
} | ||
|
||
private func setConstraints() { | ||
|
||
profileImageView.snp.makeConstraints { | ||
$0.width.height.equalTo(40) | ||
$0.top.equalToSuperview().offset(20) | ||
$0.leading.equalToSuperview().offset(20) | ||
} | ||
|
||
profileImageView.layer.cornerRadius = 20 | ||
|
||
vStackView.snp.makeConstraints { | ||
$0.centerY.equalToSuperview() | ||
$0.leading.equalTo(profileImageView.snp.trailing).inset(-20) | ||
} | ||
|
||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters