From 1f5c5a5c90d662ff4d67f8f7e50353ebc5744382 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Tue, 3 Jan 2023 11:39:50 +0900 Subject: [PATCH 1/5] =?UTF-8?q?[Feat]=20#20=20-=20NavigationBar=20?= =?UTF-8?q?=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VC/InfoVC/ActivityRecordInfoVC.swift | 22 ++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift index a51dbc40..20dfa8f1 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift @@ -6,17 +6,37 @@ // import UIKit +import SnapKit +import Then final class ActivityRecordInfoVC: UIViewController { + + // MARK: - UI Components + + private lazy var navibar = CustomNavigationBar(self, type: .titleWithLeftButton).setTitle("활동 기록") + // MARK: - View Life Cycle + override func viewDidLoad() { super.viewDidLoad() + setNavigationBar() setUI() - // Do any additional setup after loading the view. } } extension ActivityRecordInfoVC { + + // MARK: - Layout Helpers + + private func setNavigationBar() { + view.addSubview(navibar) + + navibar.snp.makeConstraints { make in + make.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) + make.height.equalTo(48) + } + } + private func setUI() { view.backgroundColor = .w1 } From f98e4d3783195da6a49da6973f0dcf6f3b682c46 Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Tue, 3 Jan 2023 13:37:33 +0900 Subject: [PATCH 2/5] =?UTF-8?q?[Feat]=20#20=20-=20ActivityRecordInfo=20?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=20=EB=B7=B0=20=EC=85=80=20=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=95=84=EC=9B=83=20=EC=9E=A1=EA=B8=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Runnect-iOS.xcodeproj/project.pbxproj | 16 ++ .../Global/Literal/ColorLiterals.swift | 4 + .../ActivityRecordInfoModel.swift | 17 ++ .../ActivityRecordInfoTVC.swift | 159 ++++++++++++++++++ .../VC/InfoVC/ActivityRecordInfoVC.swift | 29 ++++ 5 files changed, 225 insertions(+) create mode 100644 Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoModel.swift create mode 100644 Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoTVC.swift diff --git a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj index 51394f90..d054ecc8 100644 --- a/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj +++ b/Runnect-iOS/Runnect-iOS.xcodeproj/project.pbxproj @@ -13,6 +13,8 @@ A3BC2F2F2962C40A00198261 /* UploadedCourseInfoVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F2E2962C40A00198261 /* UploadedCourseInfoVC.swift */; }; A3BC2F322962E0DB00198261 /* GoalRewardInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F312962E0DB00198261 /* GoalRewardInfoModel.swift */; }; A3BC2F34296303A600198261 /* GoalRewardInfoCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F33296303A600198261 /* GoalRewardInfoCVC.swift */; }; + A3BC2F382963CE3700198261 /* ActivityRecordInfoModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F372963CE3700198261 /* ActivityRecordInfoModel.swift */; }; + A3BC2F3A2963D0ED00198261 /* ActivityRecordInfoTVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A3BC2F392963D0ED00198261 /* ActivityRecordInfoTVC.swift */; }; CE17F02D2961BBA100E1DED0 /* ColorLiterals.swift in Sources */ = {isa = PBXBuildFile; fileRef = CE17F02C2961BBA100E1DED0 /* ColorLiterals.swift */; }; CE17F0332961BEF800E1DED0 /* Pretendard-Medium.otf in Resources */ = {isa = PBXBuildFile; fileRef = CE17F02F2961BEF800E1DED0 /* Pretendard-Medium.otf */; }; CE17F0342961BEF800E1DED0 /* Pretendard-Bold.otf in Resources */ = {isa = PBXBuildFile; fileRef = CE17F0302961BEF800E1DED0 /* Pretendard-Bold.otf */; }; @@ -91,6 +93,8 @@ A3BC2F2E2962C40A00198261 /* UploadedCourseInfoVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UploadedCourseInfoVC.swift; sourceTree = ""; }; A3BC2F312962E0DB00198261 /* GoalRewardInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoalRewardInfoModel.swift; sourceTree = ""; }; A3BC2F33296303A600198261 /* GoalRewardInfoCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GoalRewardInfoCVC.swift; sourceTree = ""; }; + A3BC2F372963CE3700198261 /* ActivityRecordInfoModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityRecordInfoModel.swift; sourceTree = ""; }; + A3BC2F392963D0ED00198261 /* ActivityRecordInfoTVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ActivityRecordInfoTVC.swift; sourceTree = ""; }; CE17F02C2961BBA100E1DED0 /* ColorLiterals.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ColorLiterals.swift; sourceTree = ""; }; CE17F02F2961BEF800E1DED0 /* Pretendard-Medium.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Medium.otf"; sourceTree = ""; }; CE17F0302961BEF800E1DED0 /* Pretendard-Bold.otf */ = {isa = PBXFileReference; lastKnownFileType = file; path = "Pretendard-Bold.otf"; sourceTree = ""; }; @@ -206,6 +210,7 @@ A3BC2F292962C39F00198261 /* InfoVC */ = { isa = PBXGroup; children = ( + A3BC2F362963CD2100198261 /* ActivityRecordInfoTableView */, A3BC2F302962E08400198261 /* GoalRewardInfoCollectionView */, A3BC2F2A2962C3D500198261 /* GoalRewardInfoVC.swift */, A3BC2F2C2962C3F200198261 /* ActivityRecordInfoVC.swift */, @@ -223,6 +228,15 @@ path = GoalRewardInfoCollectionView; sourceTree = ""; }; + A3BC2F362963CD2100198261 /* ActivityRecordInfoTableView */ = { + isa = PBXGroup; + children = ( + A3BC2F372963CE3700198261 /* ActivityRecordInfoModel.swift */, + A3BC2F392963D0ED00198261 /* ActivityRecordInfoTVC.swift */, + ); + path = ActivityRecordInfoTableView; + sourceTree = ""; + }; CE17F02E2961BEAE00E1DED0 /* Fonts */ = { isa = PBXGroup; children = ( @@ -843,6 +857,7 @@ CEEC6B402961C55000D00E1E /* MyPageVC.swift in Sources */, CE665608295D921500C64E12 /* setImage.swift in Sources */, CE665612295D92E400C64E12 /* UserDefaultWrapper.swift in Sources */, + A3BC2F3A2963D0ED00198261 /* ActivityRecordInfoTVC.swift in Sources */, CE665610295D92C200C64E12 /* setTextLineHeight.swift in Sources */, CE6655E2295D87EB00C64E12 /* UIImage+.swift in Sources */, A3BC2F322962E0DB00198261 /* GoalRewardInfoModel.swift in Sources */, @@ -852,6 +867,7 @@ CE17F02D2961BBA100E1DED0 /* ColorLiterals.swift in Sources */, CEC2A68E2962AF2C00160BF7 /* RNMarker.swift in Sources */, CE6655D2295D862A00C64E12 /* Publisher+Driver.swift in Sources */, + A3BC2F382963CE3700198261 /* ActivityRecordInfoModel.swift in Sources */, CE6655E6295D887F00C64E12 /* UIStackView+.swift in Sources */, A3BC2F34296303A600198261 /* GoalRewardInfoCVC.swift in Sources */, CEB8416E2962C45300BF8080 /* LocationSearchResultTVC.swift in Sources */, diff --git a/Runnect-iOS/Runnect-iOS/Global/Literal/ColorLiterals.swift b/Runnect-iOS/Runnect-iOS/Global/Literal/ColorLiterals.swift index dedf2a48..f98c942d 100644 --- a/Runnect-iOS/Runnect-iOS/Global/Literal/ColorLiterals.swift +++ b/Runnect-iOS/Runnect-iOS/Global/Literal/ColorLiterals.swift @@ -47,6 +47,10 @@ extension UIColor { static var m4: UIColor { return UIColor(hex: "#FFFFFF") } + + static var m5: UIColor { + return UIColor(hex: "#D5D4FF") + } } extension UIColor { diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoModel.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoModel.swift new file mode 100644 index 00000000..4bda198e --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoModel.swift @@ -0,0 +1,17 @@ +// +// ActivityRecordInfoModel.swift +// Runnect-iOS +// +// Created by 몽이 누나 on 2023/01/03. +// + +import Foundation + +struct ActivityRecordInfoModel { + let title: String + let place: String + let date: String + let distance: String + let runningTime: String + let averagePace: String +} diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoTVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoTVC.swift new file mode 100644 index 00000000..7345a237 --- /dev/null +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoTVC.swift @@ -0,0 +1,159 @@ +// +// ActivityRecordInfoTVC.swift +// Runnect-iOS +// +// Created by 몽이 누나 on 2023/01/03. +// + +import UIKit +import SnapKit +import Then + +final class ActivityRecordInfoTVC: UITableViewCell { + + // MARK: - UI Components + private let activityRecordContainerView = UIView().then { + $0.layer.cornerRadius = 10 + $0.layer.borderWidth = 1 + $0.layer.borderColor = UIColor.m5.cgColor + } + + private let horizontalDivideLine = UIView() + private let firstVerticalDivideLine = UIView() + private let secondVerticalDivideLine = UIView() + private let activityRecordMapImage = UIView() + private let activityRecordTitleLabel = setBlackTitle() + private let activityRecordPlaceLabel = setGreyTitle() + + private let activityRecordVirticalBarLabel = setGreyTitle().then { + $0.text = "|" + } + + private let activityRecordDateLabel = setGreyTitle() + + private lazy var activityRecordSubTitleStackView = UIStackView(arrangedSubviews: [activityRecordPlaceLabel, activityRecordVirticalBarLabel, activityRecordDateLabel]).then { + $0.axis = .horizontal + $0.spacing = 4 + } + + private lazy var activityRecordMainInfoStackView = UIStackView(arrangedSubviews: [activityRecordTitleLabel, activityRecordSubTitleStackView]).then { + $0.axis = .vertical + $0.alignment = .center + $0.spacing = 2 + } + + private let activityRecordTotalDistanceLabel = setGreyTitle() + private let activityRecordTotalDistanceValueLabel = setBlackTitle() + + private lazy var activityRecordTotalDistanceStackView = setDetailInfoStakcView(title: activityRecordTotalDistanceLabel, value: activityRecordTotalDistanceValueLabel) + + private let activityRecordRunningTimeLabel = setGreyTitle() + private let activityRecordRunningTimeValueLabel = setBlackTitle() + + private lazy var activityRecordRunningTimeStackView = setDetailInfoStakcView(title: activityRecordRunningTimeLabel, value: activityRecordRunningTimeValueLabel) + + private let activityRecordAveragePaceLabel = setGreyTitle() + private let activityRecordAveragePaceValueLabel = setBlackTitle() + + private lazy var activityRecordAveragePaceStackView = setDetailInfoStakcView(title: activityRecordAveragePaceLabel, value: activityRecordAveragePaceValueLabel) + + private lazy var activityRecordSubInfoStackView = UIStackView(arrangedSubviews: [activityRecordTotalDistanceStackView, firstVerticalDivideLine, activityRecordRunningTimeStackView, secondVerticalDivideLine, activityRecordAveragePaceStackView]).then { + $0.axis = .horizontal + $0.spacing = 4 + } + + // MARK: - Life Cycles + + override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) { + super.init(style: style, reuseIdentifier: reuseIdentifier) + setUI() + setLayout() + } + + required init?(coder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +extension ActivityRecordInfoTVC { + + // MARK: - Method + + func setDetailInfoStakcView(title: UIView, value: UIView) -> UIStackView { + let stackView = UIStackView(arrangedSubviews: [title, value]) + stackView.axis = .vertical + stackView.alignment = .center + stackView.spacing = 2 + return stackView + } + + func setBlackTitle() -> UILabel { + let label = UILabel() + label.textColor = .g1 + label.font = .h5 + return label + } + + func setGreyTitle() -> UILabel { + let label = UILabel() + label.textColor = .g2 + label.font = .b8 + return label + } +} + +extension ActivityRecordInfoTVC { + + // MARK: - Layout Helpers + + func setUI() { + activityRecordMapImage.backgroundColor = .g3 + horizontalDivideLine.backgroundColor = .g4 + firstVerticalDivideLine.backgroundColor = .g4 + secondVerticalDivideLine.backgroundColor = .g4 + } + + func setLayout() { + activityRecordContainerView.addSubviews( + activityRecordMapImage, + activityRecordMainInfoStackView, + horizontalDivideLine, + activityRecordSubInfoStackView + ) + + activityRecordMapImage.snp.makeConstraints { make in + make.top.equalToSuperview().offset(12.72) + make.leading.equalToSuperview().offset(15) + make.width.equalTo(86) + make.height.equalTo(84.57) + } + + activityRecordMainInfoStackView.snp.makeConstraints { make in + make.centerY.equalTo(activityRecordMapImage.snp.centerY) + make.leading.equalTo(activityRecordMapImage.snp.trailing).offset(14) + } + + horizontalDivideLine.snp.makeConstraints { make in + make.top.equalTo(activityRecordMapImage.snp.bottom).offset(7.87) + make.leading.trailing.equalToSuperview().inset(10) + make.height.equalTo(1) + } + + activityRecordSubInfoStackView.snp.makeConstraints { make in + make.top.equalTo(horizontalDivideLine.snp.bottom).offset(14.82) + make.centerX.equalToSuperview() + } + } + + // MARK: - General Helpers + + func dataBind(model: ActivityRecordInfoModel) { + activityRecordTitleLabel.text = model.title + activityRecordPlaceLabel.text = model.place + activityRecordDateLabel.text = model.date + activityRecordTotalDistanceLabel.text = model.distance + activityRecordTotalDistanceValueLabel.text = model.distance + activityRecordRunningTimeValueLabel.text = model.runningTime + activityRecordAveragePaceValueLabel.text = model.averagePace + } +} diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift index 20dfa8f1..a81a7d5a 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift @@ -11,9 +11,26 @@ import Then final class ActivityRecordInfoVC: UIViewController { + // MARK: - Variables + + var activityRecordList: [ActivityRecordInfoModel] = [ + ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.28", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\""), + ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.28", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\""), + ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.28", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\""), + ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.28", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\""), + ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.28", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\""), + ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.28", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\"") + ] + // MARK: - UI Components private lazy var navibar = CustomNavigationBar(self, type: .titleWithLeftButton).setTitle("활동 기록") + + private let activityRecordTableView = UITableView().then { + $0.translatesAutoresizingMaskIntoConstraints = false + //$0.delegate = self + //$0.dataSource = self + } // MARK: - View Life Cycle @@ -21,6 +38,7 @@ final class ActivityRecordInfoVC: UIViewController { super.viewDidLoad() setNavigationBar() setUI() + setLayout() } } @@ -39,5 +57,16 @@ extension ActivityRecordInfoVC { private func setUI() { view.backgroundColor = .w1 + activityRecordTableView.backgroundColor = .w1 + } + + private func setLayout() { + view.addSubview(activityRecordTableView) + + activityRecordTableView.snp.makeConstraints { make in + make.top.equalTo(navibar.snp.bottom) + make.leading.trailing.equalTo(view.safeAreaLayoutGuide) + make.bottom.equalToSuperview() + } } } From 37a1e1acefdf795a396a522ef1bdc13af95b585d Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Tue, 3 Jan 2023 13:52:44 +0900 Subject: [PATCH 3/5] =?UTF-8?q?[Fix]=20#20=20-=20=ED=95=A8=EC=88=98=20?= =?UTF-8?q?=EA=B3=A0=EC=B9=98=EB=8A=94=20=EC=A4=91..?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../VC/InfoVC/ActivityRecordInfoVC.swift | 34 +++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift index a81a7d5a..272a302d 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift @@ -28,8 +28,8 @@ final class ActivityRecordInfoVC: UIViewController { private let activityRecordTableView = UITableView().then { $0.translatesAutoresizingMaskIntoConstraints = false - //$0.delegate = self - //$0.dataSource = self + $0.delegate = self + $0.dataSource = self } // MARK: - View Life Cycle @@ -39,6 +39,7 @@ final class ActivityRecordInfoVC: UIViewController { setNavigationBar() setUI() setLayout() + register() } } @@ -69,4 +70,33 @@ extension ActivityRecordInfoVC { make.bottom.equalToSuperview() } } + + // MARK: - General Helpers + + private func register() { + activityRecordTableView.register(ActivityRecordInfoTVC.self, + forCellWithReuseIdentifier: ActivityRecordInfoTVC.className) + } +} + +// MARK: - UITableViewDelegate + +extension ActivityRecordInfoVC: UITableViewDelegate { + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 177 + } +} + +// MARK: - UITableViewDataSource + +extension ActivityRecordInfoVC: UITableViewDataSource { + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return activityRecordList.count + } + + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + guard let activityRecordCell = tableView.dequeueReusableCell(withIdentifier: ActivityRecordInfoTVC.className, for: indexPath) as? ActivityRecordInfoTVC else { return UITableViewCell()} + activityRecordCell.dataBind(model: activityRecordList[indexPath.item]) + return activityRecordCell + } } From fa64ef0ea387f9e0b29167b4e5268982fb15b83a Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Tue, 3 Jan 2023 15:07:27 +0900 Subject: [PATCH 4/5] =?UTF-8?q?[Fix]=20#20=20-=20ActivityRecordInfo=20?= =?UTF-8?q?=ED=85=8C=EC=9D=B4=EB=B8=94=20=EB=B7=B0=20=EC=85=80=20=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=95=84=EC=9B=83=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ActivityRecordInfoTVC.swift | 67 ++++++++++++++----- .../VC/InfoVC/ActivityRecordInfoVC.swift | 18 ++--- 2 files changed, 60 insertions(+), 25 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoTVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoTVC.swift index 7345a237..070bc85e 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoTVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoTVC.swift @@ -12,6 +12,7 @@ import Then final class ActivityRecordInfoTVC: UITableViewCell { // MARK: - UI Components + private let activityRecordContainerView = UIView().then { $0.layer.cornerRadius = 10 $0.layer.borderWidth = 1 @@ -21,15 +22,19 @@ final class ActivityRecordInfoTVC: UITableViewCell { private let horizontalDivideLine = UIView() private let firstVerticalDivideLine = UIView() private let secondVerticalDivideLine = UIView() - private let activityRecordMapImage = UIView() - private let activityRecordTitleLabel = setBlackTitle() - private let activityRecordPlaceLabel = setGreyTitle() - private let activityRecordVirticalBarLabel = setGreyTitle().then { + private let activityRecordMapImage = UIView().then { + $0.layer.cornerRadius = 10 + } + + private lazy var activityRecordTitleLabel = setBlackTitle() + private lazy var activityRecordPlaceLabel = setGreyTitle() + + private lazy var activityRecordVirticalBarLabel = setGreyTitle().then { $0.text = "|" } - private let activityRecordDateLabel = setGreyTitle() + private lazy var activityRecordDateLabel = setGreyTitle() private lazy var activityRecordSubTitleStackView = UIStackView(arrangedSubviews: [activityRecordPlaceLabel, activityRecordVirticalBarLabel, activityRecordDateLabel]).then { $0.axis = .horizontal @@ -38,28 +43,35 @@ final class ActivityRecordInfoTVC: UITableViewCell { private lazy var activityRecordMainInfoStackView = UIStackView(arrangedSubviews: [activityRecordTitleLabel, activityRecordSubTitleStackView]).then { $0.axis = .vertical - $0.alignment = .center - $0.spacing = 2 + $0.alignment = .leading + $0.spacing = 7 } - private let activityRecordTotalDistanceLabel = setGreyTitle() - private let activityRecordTotalDistanceValueLabel = setBlackTitle() + private lazy var activityRecordTotalDistanceValueLabel = setBlackTitle() + private lazy var activityRecordRunningTimeValueLabel = setBlackTitle() + private lazy var activityRecordAveragePaceValueLabel = setBlackTitle() - private lazy var activityRecordTotalDistanceStackView = setDetailInfoStakcView(title: activityRecordTotalDistanceLabel, value: activityRecordTotalDistanceValueLabel) + private lazy var activityRecordTotalDistanceLabel = setGreyTitle().then { + $0.text = "총 거리" + } + + private lazy var activityRecordRunningTimeLabel = setGreyTitle().then { + $0.text = "이동 시간" + } - private let activityRecordRunningTimeLabel = setGreyTitle() - private let activityRecordRunningTimeValueLabel = setBlackTitle() + private lazy var activityRecordAveragePaceLabel = setGreyTitle().then { + $0.text = "평균 페이스" + } - private lazy var activityRecordRunningTimeStackView = setDetailInfoStakcView(title: activityRecordRunningTimeLabel, value: activityRecordRunningTimeValueLabel) + private lazy var activityRecordTotalDistanceStackView = setDetailInfoStakcView(title: activityRecordTotalDistanceLabel, value: activityRecordTotalDistanceValueLabel) - private let activityRecordAveragePaceLabel = setGreyTitle() - private let activityRecordAveragePaceValueLabel = setBlackTitle() + private lazy var activityRecordRunningTimeStackView = setDetailInfoStakcView(title: activityRecordRunningTimeLabel, value: activityRecordRunningTimeValueLabel) private lazy var activityRecordAveragePaceStackView = setDetailInfoStakcView(title: activityRecordAveragePaceLabel, value: activityRecordAveragePaceValueLabel) private lazy var activityRecordSubInfoStackView = UIStackView(arrangedSubviews: [activityRecordTotalDistanceStackView, firstVerticalDivideLine, activityRecordRunningTimeStackView, secondVerticalDivideLine, activityRecordAveragePaceStackView]).then { $0.axis = .horizontal - $0.spacing = 4 + $0.distribution = .fillProportionally } // MARK: - Life Cycles @@ -114,6 +126,14 @@ extension ActivityRecordInfoTVC { } func setLayout() { + addSubview(activityRecordContainerView) + + activityRecordContainerView.snp.makeConstraints { make in + make.top.equalToSuperview() + make.leading.trailing.equalToSuperview().inset(16) + make.height.equalTo(177) + } + activityRecordContainerView.addSubviews( activityRecordMapImage, activityRecordMainInfoStackView, @@ -139,19 +159,32 @@ extension ActivityRecordInfoTVC { make.height.equalTo(1) } + firstVerticalDivideLine.snp.makeConstraints { make in + make.width.equalTo(1) + } + + secondVerticalDivideLine.snp.makeConstraints { make in + make.width.equalTo(1) + } + activityRecordSubInfoStackView.snp.makeConstraints { make in make.top.equalTo(horizontalDivideLine.snp.bottom).offset(14.82) + make.width.equalToSuperview() make.centerX.equalToSuperview() } } + override func layoutSubviews() { + super.layoutSubviews() + contentView.frame = contentView.frame.inset(by: UIEdgeInsets(top: 0, left: 0, bottom: 16, right: 0)) + } + // MARK: - General Helpers func dataBind(model: ActivityRecordInfoModel) { activityRecordTitleLabel.text = model.title activityRecordPlaceLabel.text = model.place activityRecordDateLabel.text = model.date - activityRecordTotalDistanceLabel.text = model.distance activityRecordTotalDistanceValueLabel.text = model.distance activityRecordRunningTimeValueLabel.text = model.runningTime activityRecordAveragePaceValueLabel.text = model.averagePace diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift index 272a302d..7cb50425 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift @@ -15,9 +15,9 @@ final class ActivityRecordInfoVC: UIViewController { var activityRecordList: [ActivityRecordInfoModel] = [ ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.28", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\""), - ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.28", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\""), - ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.28", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\""), - ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.28", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\""), + ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.29", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\""), + ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.30", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\""), + ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.31", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\""), ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.28", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\""), ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.28", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\"") ] @@ -26,8 +26,10 @@ final class ActivityRecordInfoVC: UIViewController { private lazy var navibar = CustomNavigationBar(self, type: .titleWithLeftButton).setTitle("활동 기록") - private let activityRecordTableView = UITableView().then { + private lazy var activityRecordTableView = UITableView().then { $0.translatesAutoresizingMaskIntoConstraints = false + $0.showsVerticalScrollIndicator = false + $0.separatorStyle = .none $0.delegate = self $0.dataSource = self } @@ -65,7 +67,7 @@ extension ActivityRecordInfoVC { view.addSubview(activityRecordTableView) activityRecordTableView.snp.makeConstraints { make in - make.top.equalTo(navibar.snp.bottom) + make.top.equalTo(navibar.snp.bottom).offset(16) make.leading.trailing.equalTo(view.safeAreaLayoutGuide) make.bottom.equalToSuperview() } @@ -74,8 +76,7 @@ extension ActivityRecordInfoVC { // MARK: - General Helpers private func register() { - activityRecordTableView.register(ActivityRecordInfoTVC.self, - forCellWithReuseIdentifier: ActivityRecordInfoTVC.className) + activityRecordTableView.register(ActivityRecordInfoTVC.self, forCellReuseIdentifier: ActivityRecordInfoTVC.className) } } @@ -83,7 +84,7 @@ extension ActivityRecordInfoVC { extension ActivityRecordInfoVC: UITableViewDelegate { func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - return 177 + return 193 } } @@ -96,6 +97,7 @@ extension ActivityRecordInfoVC: UITableViewDataSource { func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { guard let activityRecordCell = tableView.dequeueReusableCell(withIdentifier: ActivityRecordInfoTVC.className, for: indexPath) as? ActivityRecordInfoTVC else { return UITableViewCell()} + activityRecordCell.selectionStyle = .none activityRecordCell.dataBind(model: activityRecordList[indexPath.item]) return activityRecordCell } From 743f32853b6888fc2691e21d14436325e0e0a86b Mon Sep 17 00:00:00 2001 From: dlwogus0128 <79050615+dlwogus0128@users.noreply.github.com> Date: Tue, 3 Jan 2023 22:20:19 +0900 Subject: [PATCH 5/5] =?UTF-8?q?[Fix]=20#20=20-=20=EC=BD=94=EB=A9=98?= =?UTF-8?q?=ED=8A=B8=20=EB=B0=9B=EC=9D=80=20=EB=B6=80=EB=B6=84=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ActivityRecordInfoTVC.swift | 8 ++++---- .../MyPage/VC/InfoVC/ActivityRecordInfoVC.swift | 3 +-- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoTVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoTVC.swift index 070bc85e..8d1c979e 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoTVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoTableView/ActivityRecordInfoTVC.swift @@ -142,10 +142,10 @@ extension ActivityRecordInfoTVC { ) activityRecordMapImage.snp.makeConstraints { make in - make.top.equalToSuperview().offset(12.72) + make.top.equalToSuperview().offset(13) make.leading.equalToSuperview().offset(15) make.width.equalTo(86) - make.height.equalTo(84.57) + make.height.equalTo(85) } activityRecordMainInfoStackView.snp.makeConstraints { make in @@ -154,7 +154,7 @@ extension ActivityRecordInfoTVC { } horizontalDivideLine.snp.makeConstraints { make in - make.top.equalTo(activityRecordMapImage.snp.bottom).offset(7.87) + make.top.equalTo(activityRecordMapImage.snp.bottom).offset(8) make.leading.trailing.equalToSuperview().inset(10) make.height.equalTo(1) } @@ -168,7 +168,7 @@ extension ActivityRecordInfoTVC { } activityRecordSubInfoStackView.snp.makeConstraints { make in - make.top.equalTo(horizontalDivideLine.snp.bottom).offset(14.82) + make.top.equalTo(horizontalDivideLine.snp.bottom).offset(15) make.width.equalToSuperview() make.centerX.equalToSuperview() } diff --git a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift index 7cb50425..85a7547e 100644 --- a/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift +++ b/Runnect-iOS/Runnect-iOS/Presentation/MyPage/VC/InfoVC/ActivityRecordInfoVC.swift @@ -11,7 +11,7 @@ import Then final class ActivityRecordInfoVC: UIViewController { - // MARK: - Variables + // MARK: - Properties var activityRecordList: [ActivityRecordInfoModel] = [ ActivityRecordInfoModel(title: "석촌 호수 한 바퀴", place: "서울시 강동구", date: "2022.12.28", distance: "4.01 km", runningTime: "0:27:36", averagePace: "6'45\""), @@ -27,7 +27,6 @@ final class ActivityRecordInfoVC: UIViewController { private lazy var navibar = CustomNavigationBar(self, type: .titleWithLeftButton).setTitle("활동 기록") private lazy var activityRecordTableView = UITableView().then { - $0.translatesAutoresizingMaskIntoConstraints = false $0.showsVerticalScrollIndicator = false $0.separatorStyle = .none $0.delegate = self