From d8145e384c43a938b43f207ba5c07a18d2974e7f Mon Sep 17 00:00:00 2001 From: zeke Date: Fri, 11 Jun 2021 17:49:57 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=E2=9C=A8=20=20IssueTableView=20Cell=20?= =?UTF-8?q?=EA=B5=AC=ED=98=84=20(#27)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../View/IssueList/IssueTableViewCell.swift | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 iOS/issue-tracker/issue-tracker/View/IssueList/IssueTableViewCell.swift diff --git a/iOS/issue-tracker/issue-tracker/View/IssueList/IssueTableViewCell.swift b/iOS/issue-tracker/issue-tracker/View/IssueList/IssueTableViewCell.swift new file mode 100644 index 000000000..c6dc8ec32 --- /dev/null +++ b/iOS/issue-tracker/issue-tracker/View/IssueList/IssueTableViewCell.swift @@ -0,0 +1,112 @@ +// +// LabelTableViewCell.swift +// issue-tracker +// +// Created by 양준혁 on 2021/06/09. +// + +import UIKit +import SnapKit + +class IssueTableViewCell: UITableViewCell { + + static var identifier = "IssueTableViewCell" + + var largeTitle: UILabel = { + var label = UILabel() + label.font = UIFont.boldSystemFont(ofSize: 22) + return label + }() + + var labelDescription: UILabel = { + var label = UILabel() + label.textColor = .lightGray + return label + }() + + var milestoneView: MilestoneView = { + var milestone = MilestoneView() + return milestone + }() + + var labelView: PaddingLabel = { + var label = PaddingLabel(withInsets: 0, 0, 10, 10) + label.textAlignment = .center + label.textColor = .white + label.layer.masksToBounds = true + label.layer.cornerRadius = 15 + return label + }() + + var checkBoxImageView: UIImageView = { + var imageView = UIImageView() + imageView.image = UIImage(systemName: "checkmark.circle.fill") + return imageView + }() + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + addSubviews() + setAutolayout() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + func addSubviews() { + addSubview(labelView) + addSubview(labelDescription) + addSubview(milestoneView) + addSubview(largeTitle) + } + + func setAutolayout() { + largeTitle.snp.makeConstraints { title in + title.top.equalTo(24) + title.leading.trailing.equalTo(16) + title.height.equalTo(28) + } + + labelDescription.snp.makeConstraints { label in + label.top.equalTo(largeTitle.snp.bottom).offset(16) + label.leading.trailing.equalToSuperview().offset(16) + label.height.equalTo(22) + } + + milestoneView.snp.makeConstraints { view in + view.top.equalTo(labelDescription.snp.bottom).offset(16) + view.leading.trailing.equalTo(16) + view.height.equalTo(22) + } + + labelView.snp.makeConstraints { view in + view.top.equalTo(milestoneView.snp.bottom).offset(16) + view.leading.equalTo(16) + view.width.greaterThanOrEqualTo(30) + view.height.equalTo(30) + } + } + + func setIssueCell(title: String, description: String, milestoneTitle: String, color: String) { + self.largeTitle.text = title + self.labelDescription.text = description + self.milestoneView.setMilestoneTitle(title: milestoneTitle) + self.labelView.backgroundColor = UIColor.hexStringToUIColor(hex: color) + self.labelView.text = "레이블 이름" + } + + func check() { + addSubview(checkBoxImageView) + + checkBoxImageView.snp.makeConstraints { image in + image.top.equalToSuperview().inset(24) + image.trailing.equalToSuperview().inset(16) + image.width.height.equalTo(30) + } + } + + func uncheck() { + checkBoxImageView.removeFromSuperview() + } +}