From 91cfa27149f4b4f21a07f1efa49deb0c486b9c79 Mon Sep 17 00:00:00 2001 From: Choi YoungLyn Date: Wed, 13 Jul 2022 02:33:48 +0900 Subject: [PATCH 01/12] =?UTF-8?q?[Design]=20#22-=EB=A6=AC=EB=B7=B0=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1=20UI=20=EC=9A=94=EC=86=8C=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HealthFoodMe.xcodeproj/project.pbxproj | 24 ++ .../Application/SceneDelegate.swift | 2 +- .../Global/Literals/StoryboardLiterals.swift | 1 + .../VC/ReviewWrite.storyboard | 33 +++ .../ReviewWriteScene/VC/ReviewWriteVC.swift | 244 ++++++++++++++++++ 5 files changed, 303 insertions(+), 1 deletion(-) create mode 100644 HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWrite.storyboard create mode 100644 HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift diff --git a/HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj b/HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj index cf2a5ffc..cc5e6519 100644 --- a/HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj +++ b/HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj @@ -24,6 +24,8 @@ 690AB5492875C1B200DE72D4 /* MenuDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690AB5482875C1B200DE72D4 /* MenuDataModel.swift */; }; 695758B7287D7B6700E36789 /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 695758B6287D7B6700E36789 /* Config.swift */; }; 695758B9287D7C0B00E36789 /* MenuTab.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 695758B8287D7C0B00E36789 /* MenuTab.storyboard */; }; + 695758BD287DA4CD00E36789 /* ReviewWrite.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 695758BC287DA4CD00E36789 /* ReviewWrite.storyboard */; }; + 695758BF287DA50000E36789 /* ReviewWriteVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 695758BE287DA50000E36789 /* ReviewWriteVC.swift */; }; A938BB8E287D221200B8DE07 /* Search.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A938BB8D287D221200B8DE07 /* Search.storyboard */; }; A938BB90287D222800B8DE07 /* MainDetail.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A938BB8F287D222800B8DE07 /* MainDetail.storyboard */; }; A9525F712873E1750065EB1D /* SearchVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9525F702873E1750065EB1D /* SearchVC.swift */; }; @@ -139,6 +141,8 @@ 690AB5482875C1B200DE72D4 /* MenuDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MenuDataModel.swift; sourceTree = ""; }; 695758B6287D7B6700E36789 /* Config.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Config.swift; path = ../../../../../../../../Downloads/Config.swift; sourceTree = ""; }; 695758B8287D7C0B00E36789 /* MenuTab.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MenuTab.storyboard; sourceTree = ""; }; + 695758BC287DA4CD00E36789 /* ReviewWrite.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = ReviewWrite.storyboard; sourceTree = ""; }; + 695758BE287DA50000E36789 /* ReviewWriteVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewWriteVC.swift; sourceTree = ""; }; A938BB8D287D221200B8DE07 /* Search.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Search.storyboard; sourceTree = ""; }; A938BB8F287D222800B8DE07 /* MainDetail.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MainDetail.storyboard; sourceTree = ""; }; A9525F702873E1750065EB1D /* SearchVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchVC.swift; sourceTree = ""; }; @@ -276,6 +280,23 @@ path = VC; sourceTree = ""; }; + 695758BA287DA4A400E36789 /* ReviewWriteScene */ = { + isa = PBXGroup; + children = ( + 695758BB287DA4B700E36789 /* VC */, + ); + path = ReviewWriteScene; + sourceTree = ""; + }; + 695758BB287DA4B700E36789 /* VC */ = { + isa = PBXGroup; + children = ( + 695758BC287DA4CD00E36789 /* ReviewWrite.storyboard */, + 695758BE287DA50000E36789 /* ReviewWriteVC.swift */, + ); + path = VC; + sourceTree = ""; + }; 697074FB28737D78001A607F /* MenuTabScene */ = { isa = PBXGroup; children = ( @@ -428,6 +449,7 @@ EB6A44C828737BF700749582 /* Detail */ = { isa = PBXGroup; children = ( + 695758BA287DA4A400E36789 /* ReviewWriteScene */, 697074FB28737D78001A607F /* MenuTabScene */, EB6A44C928737C4600749582 /* MainDetailScene */, ); @@ -1042,6 +1064,7 @@ 695758B9287D7C0B00E36789 /* MenuTab.storyboard in Resources */, 3B0B25542876BBE400950539 /* NotoSansCJKkr-Regular.otf in Resources */, A938BB90287D222800B8DE07 /* MainDetail.storyboard in Resources */, + 695758BD287DA4CD00E36789 /* ReviewWrite.storyboard in Resources */, 3BCC442028745FE500661A12 /* SocialLogin.storyboard in Resources */, 3B0B25562876BBE400950539 /* Pretendard-Regular.otf in Resources */, EBF66AD0287227F500DE0ED1 /* Assets.xcassets in Resources */, @@ -1147,6 +1170,7 @@ EBF66B01287227F500DE0ED1 /* PostDetail.swift in Sources */, EBF66ABC287227F500DE0ED1 /* UserDefaults+.swift in Sources */, EBF66AC3287227F500DE0ED1 /* UILabel+.swift in Sources */, + 695758BF287DA50000E36789 /* ReviewWriteVC.swift in Sources */, EBF66AFE287227F500DE0ED1 /* makeVibrate.swift in Sources */, EBF66B0A2872B21F00DE0ED1 /* StringLiterals.swift in Sources */, EB6A45172874276B00749582 /* DetailTabTitleHeader.swift in Sources */, diff --git a/HealthFoodMe/HealthFoodMe/Application/SceneDelegate.swift b/HealthFoodMe/HealthFoodMe/Application/SceneDelegate.swift index ecf2d630..3bd52df2 100644 --- a/HealthFoodMe/HealthFoodMe/Application/SceneDelegate.swift +++ b/HealthFoodMe/HealthFoodMe/Application/SceneDelegate.swift @@ -34,7 +34,7 @@ class SceneDelegate: UIResponder, UIWindowSceneDelegate { } guard let windowScene = (scene as? UIWindowScene) else { return } - let rootViewController = ModuleFactory.resolve().makeSearchVC() + let rootViewController = ReviewWriteVC.controllerFromStoryboard(.reviewWrite) let navigation = UINavigationController(rootViewController: rootViewController) let window = UIWindow(windowScene: windowScene) window.rootViewController = navigation diff --git a/HealthFoodMe/HealthFoodMe/Global/Literals/StoryboardLiterals.swift b/HealthFoodMe/HealthFoodMe/Global/Literals/StoryboardLiterals.swift index aa3133ea..21132992 100644 --- a/HealthFoodMe/HealthFoodMe/Global/Literals/StoryboardLiterals.swift +++ b/HealthFoodMe/HealthFoodMe/Global/Literals/StoryboardLiterals.swift @@ -20,6 +20,7 @@ enum Storyboards: String { case mainDetail = "MainDetail" case search = "Search" case menuTab = "MenuTab" + case reviewWrite = "ReviewWrite" } extension UIStoryboard { diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWrite.storyboard b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWrite.storyboard new file mode 100644 index 00000000..9033fe43 --- /dev/null +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWrite.storyboard @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift new file mode 100644 index 00000000..e1202c61 --- /dev/null +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift @@ -0,0 +1,244 @@ +// +// ReviewWriteVC.swift +// HealthFoodMe +// +// Created by 최영린 on 2022/07/12. +// + +import UIKit + +import SnapKit + +class ReviewWriteVC: UIViewController, UIScrollViewDelegate { + + // MARK: - Properties + + // MARK: - UI Components + + private lazy var scrollView: UIScrollView = { + let scrollView = UIScrollView() + scrollView.translatesAutoresizingMaskIntoConstraints = false + scrollView.backgroundColor = .white + scrollView.showsVerticalScrollIndicator = false + return scrollView + }() + + private let contentView: UIView = { + let view = UIView() + view.translatesAutoresizingMaskIntoConstraints = false + return view + }() + + private lazy var restaurantTitleLabel: UILabel = { + let lb = UILabel() + lb.text = "샐러디 태릉입구점" + lb.textColor = .helfmeBlack + lb.font = .NotoBold(size: 16) + return lb + }() + + private lazy var lineView: UIView = { + let view = UIView() + view.backgroundColor = .helfmeLineGray + return view + }() + + private let questionTasteLabel: UILabel = { + let lb = UILabel() + lb.text = "맛은 어때요?" + lb.textColor = .helfmeBlack + lb.font = .NotoBold(size: 14) + return lb + }() + + private lazy var tagGood: UIButton = { + let btn = UIButton() + btn.setTitle("맛최고", for: .normal) + btn.tintColor = .helfmeBlack + btn.backgroundColor = .helfmeLineGray + return btn + }() + + private lazy var tagSoso: UIButton = { + let btn = UIButton() + btn.setTitle("맛그럭저럭", for: .normal) + btn.tintColor = .helfmeBlack + btn.backgroundColor = .helfmeLineGray + return btn + }() + + private lazy var tagBad: UIButton = { + let btn = UIButton() + btn.setTitle("맛 별로", for: .normal) + btn.tintColor = .helfmeBlack + btn.backgroundColor = .helfmeLineGray + return btn + }() + + private lazy var tagTasteStackView: UIStackView = { + let sv = UIStackView() + sv.axis = .horizontal + sv.alignment = .center + sv.spacing = 6 + sv.addArrangedSubviews(tagGood, tagSoso, tagBad) + return sv + }() + + private let questionHelpfulLabel: UILabel = { + let lb = UILabel() + lb.text = "어떤 점이 좋았나요?" + lb.textColor = .helfmeBlack + lb.font = .NotoBold(size: 14) + return lb + }() + + private lazy var tagDiet: UIButton = { + let btn = UIButton() + btn.setTitle("다이어트용", for: .normal) + btn.tintColor = .helfmeBlack + btn.backgroundColor = .helfmeLineGray + return btn + }() + + private lazy var tagHealthFood: UIButton = { + let btn = UIButton() + btn.setTitle("건강식", for: .normal) + btn.tintColor = .helfmeBlack + btn.backgroundColor = .helfmeLineGray + return btn + }() + + private lazy var tagCheet: UIButton = { + let btn = UIButton() + btn.setTitle("치팅데이용", for: .normal) + btn.tintColor = .helfmeBlack + btn.backgroundColor = .helfmeLineGray + return btn + }() + + private lazy var tagHelpfulStackView: UIStackView = { + let sv = UIStackView() + sv.axis = .horizontal + sv.alignment = .center + sv.spacing = 6 + sv.addArrangedSubviews(tagDiet, tagHealthFood, tagCheet) + return sv + }() + + private let reviewLabel: UILabel = { + let lb = UILabel() + lb.text = "후기를 남겨주세요." + lb.textColor = .helfmeBlack + lb.font = .NotoBold(size: 14) + return lb + }() + + private let reviewSubLabel: UILabel = { + let lb = UILabel() + lb.text = "식당 이용 후기, 메뉴추천, 꿀팁 등 자유롭게 작성해주세요!" + lb.textColor = .helfmeGray2 + lb.font = .NotoRegular(size: 10) + return lb + }() + + private lazy var reviewStackView: UIStackView = { + let sv = UIStackView() + sv.axis = .vertical + sv.alignment = .leading + sv.spacing = 6 + sv.addArrangedSubviews(reviewLabel, reviewSubLabel) + return sv + }() + + private lazy var reviewTextVeiw: UITextView = { + let tv = UITextView() + tv.text = "리뷰를 작성해주세요 (최대 500자)" + tv.textColor = .helfmeGray2 + tv.backgroundColor = .helfmeBgGray + tv.layer.cornerRadius = 8 + return tv + }() + + // MARK: - View Life Cycle + + override func viewDidLoad() { + super.viewDidLoad() + setDelegate() + setNavigation() + setLayout() + } +} + +// MARK: - Methods + +extension ReviewWriteVC { + private func setDelegate() { + scrollView.delegate = self + } + + private func setNavigation() { + self.navigationItem.title = "리뷰 작성" + } + + private func setLayout() { + view.addSubview(scrollView) + scrollView.snp.makeConstraints { make in + make.edges.equalTo(view.safeAreaLayoutGuide) + } + + scrollView.addSubview(contentView) + contentView.snp.makeConstraints { make in + make.edges.equalTo(view.safeAreaLayoutGuide) + } + + contentView.addSubviews(restaurantTitleLabel, lineView, questionTasteLabel, tagTasteStackView, questionHelpfulLabel, tagHelpfulStackView, reviewStackView, reviewTextVeiw) + + restaurantTitleLabel.snp.makeConstraints { make in + make.top.equalToSuperview().inset(20) + make.centerX.equalToSuperview() + } + + lineView.snp.makeConstraints { make in + make.top.equalTo(restaurantTitleLabel.snp.bottom).offset(67) + make.leading.trailing.equalToSuperview().inset(20) + make.height.equalTo(1) + } + + questionTasteLabel.snp.makeConstraints { make in + make.top.equalTo(lineView.snp.bottom).offset(24) + make.leading.equalToSuperview().inset(20) + } + + tagTasteStackView.snp.makeConstraints { make in + make.top.equalTo(questionTasteLabel.snp.bottom).offset(10) + make.leading.equalToSuperview().inset(20) + } + + questionHelpfulLabel.snp.makeConstraints { make in + make.top.equalTo(tagTasteStackView.snp.bottom).offset(24) + make.leading.equalToSuperview().inset(20) + } + + tagHelpfulStackView.snp.makeConstraints { make in + make.top.equalTo(questionHelpfulLabel.snp.bottom).offset(10) + make.leading.equalToSuperview().inset(20) + } + + reviewStackView.snp.makeConstraints { make in + make.top.equalTo(tagHelpfulStackView.snp.bottom).offset(24) + make.leading.equalToSuperview().inset(20) + } + + reviewTextVeiw.snp.makeConstraints { make in + make.top.equalTo(reviewStackView.snp.bottom).offset(10) + make.leading.trailing.equalToSuperview().inset(20) + make.height.equalTo(800) + } + } +} + +// MARK: - Network + +extension ReviewWriteVC { + +} From 62891a23de4765100343f04c59eaabdcef052907 Mon Sep 17 00:00:00 2001 From: Choi YoungLyn Date: Wed, 13 Jul 2022 02:36:54 +0900 Subject: [PATCH 02/12] =?UTF-8?q?[Design]=20#22-TextView=20Placeholder=20?= =?UTF-8?q?=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReviewWriteScene/VC/ReviewWriteVC.swift | 30 +++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift index e1202c61..299edea1 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift @@ -174,6 +174,7 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { extension ReviewWriteVC { private func setDelegate() { scrollView.delegate = self + reviewTextVeiw.delegate = self } private func setNavigation() { @@ -242,3 +243,32 @@ extension ReviewWriteVC { extension ReviewWriteVC { } + +extension ReviewWriteVC: UITextViewDelegate { + func textViewDidBeginEditing(_ textView: UITextView) { + if textView.textColor == .helfmeGray2 { + textView.text = nil + textView.textColor = .helfmeBlack + } + } + + func textViewDidEndEditing(_ textView: UITextView) { + if textView.text.isEmpty { + textView.text = "리뷰를 작성해주세요 (최대 500자)" + textView.textColor = .helfmeGray2 + } + } + + func textViewDidChange(_ textView: UITextView) { + let size = CGSize(width: view.frame.width, height: .infinity) + let estimatedSize = textView.sizeThatFits(size) + textView.constraints.forEach { (constraint) in + if estimatedSize.height >= 277 { + if constraint.firstAttribute == .height { + constraint.constant = estimatedSize.height + } + } + } + } +} + From cc73a55500d3c51e99320afcdbb0cd682aa56be9 Mon Sep 17 00:00:00 2001 From: Choi YoungLyn Date: Wed, 13 Jul 2022 02:57:27 +0900 Subject: [PATCH 03/12] =?UTF-8?q?[Design]=20=EB=A6=AC=EB=B7=B0=20=EC=9E=91?= =?UTF-8?q?=EC=84=B1=20ScrollView=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Detail/ReviewWriteScene/VC/ReviewWriteVC.swift | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift index 299edea1..b3c26422 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift @@ -189,7 +189,9 @@ extension ReviewWriteVC { scrollView.addSubview(contentView) contentView.snp.makeConstraints { make in - make.edges.equalTo(view.safeAreaLayoutGuide) + make.edges.equalTo(scrollView.contentLayoutGuide) + make.height.greaterThanOrEqualTo(view.snp.height).priority(.low) + make.width.equalTo(scrollView.snp.width) } contentView.addSubviews(restaurantTitleLabel, lineView, questionTasteLabel, tagTasteStackView, questionHelpfulLabel, tagHelpfulStackView, reviewStackView, reviewTextVeiw) @@ -233,8 +235,10 @@ extension ReviewWriteVC { reviewTextVeiw.snp.makeConstraints { make in make.top.equalTo(reviewStackView.snp.bottom).offset(10) make.leading.trailing.equalToSuperview().inset(20) - make.height.equalTo(800) + make.height.equalTo(277) } + + } } @@ -271,4 +275,3 @@ extension ReviewWriteVC: UITextViewDelegate { } } } - From f12ac7f52c597a4367a7efa9bc149ae5795a3747 Mon Sep 17 00:00:00 2001 From: Choi YoungLyn Date: Wed, 13 Jul 2022 18:54:35 +0900 Subject: [PATCH 04/12] =?UTF-8?q?[Design]=20#22-=EB=A6=AC=EB=B7=B0?= =?UTF-8?q?=EC=9E=91=EC=84=B1=20UI=20=EB=B3=80=EA=B2=BD=EB=90=9C=20?= =?UTF-8?q?=EB=B6=80=EB=B6=84=20=EC=9E=AC=EA=B5=AC=ED=98=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReviewWriteScene/VC/ReviewWriteVC.swift | 147 ++++++++++++++++-- 1 file changed, 137 insertions(+), 10 deletions(-) diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift index b3c26422..733f35a2 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift @@ -51,6 +51,23 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { return lb }() + private let questionTasteSubLabel: UILabel = { + let lb = UILabel() + lb.text = "필수 한 개 선택해주세요! " + lb.textColor = .helfmeGray2 + lb.font = .NotoRegular(size: 12) + return lb + }() + + private lazy var questionTasteStackView: UIStackView = { + let sv = UIStackView() + sv.axis = .vertical + sv.alignment = .leading + sv.spacing = 4 + sv.addArrangedSubviews(questionTasteLabel, questionTasteSubLabel) + return sv + }() + private lazy var tagGood: UIButton = { let btn = UIButton() btn.setTitle("맛최고", for: .normal) @@ -84,7 +101,7 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { return sv }() - private let questionHelpfulLabel: UILabel = { + private let questionFeelingLabel: UILabel = { let lb = UILabel() lb.text = "어떤 점이 좋았나요?" lb.textColor = .helfmeBlack @@ -92,6 +109,23 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { return lb }() + private let questionFeelingSubLabel: UILabel = { + let lb = UILabel() + lb.text = "식당을 방문하신 후 좋았던 부분에 체크해주세요! (중복가능)" + lb.textColor = .helfmeGray2 + lb.font = .NotoRegular(size: 12) + return lb + }() + + private lazy var questionFeelingStackView: UIStackView = { + let sv = UIStackView() + sv.axis = .vertical + sv.alignment = .leading + sv.spacing = 4 + sv.addArrangedSubviews(questionFeelingLabel, questionFeelingSubLabel) + return sv + }() + private lazy var tagDiet: UIButton = { let btn = UIButton() btn.setTitle("다이어트용", for: .normal) @@ -137,7 +171,7 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { let lb = UILabel() lb.text = "식당 이용 후기, 메뉴추천, 꿀팁 등 자유롭게 작성해주세요!" lb.textColor = .helfmeGray2 - lb.font = .NotoRegular(size: 10) + lb.font = .NotoRegular(size: 12) return lb }() @@ -145,7 +179,7 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { let sv = UIStackView() sv.axis = .vertical sv.alignment = .leading - sv.spacing = 6 + sv.spacing = 4 sv.addArrangedSubviews(reviewLabel, reviewSubLabel) return sv }() @@ -159,6 +193,42 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { return tv }() + private let pictureLabel: UILabel = { + let lb = UILabel() + lb.text = "사진을 올려주세요" + lb.textColor = .helfmeBlack + lb.font = .NotoBold(size: 14) + return lb + }() + + private let pictureOptionLabel: UILabel = { + let lb = UILabel() + lb.text = "(선택)" + lb.textColor = .helfmeGray2 + lb.font = .NotoRegular(size: 10) + return lb + }() + + private lazy var pictureStackView: UIStackView = { + let sv = UIStackView() + sv.axis = .horizontal + sv.alignment = .center + sv.spacing = 6 + sv.addArrangedSubviews(pictureLabel, pictureOptionLabel) + return sv + }() + + private lazy var photoCV: UICollectionView = { + let layout = UICollectionViewFlowLayout() + layout.minimumLineSpacing = 0 + layout.scrollDirection = .horizontal + layout.sectionInset = .zero + + let cv = UICollectionView(frame: .zero, collectionViewLayout: layout) + cv.showsVerticalScrollIndicator = false + return cv + }() + // MARK: - View Life Cycle override func viewDidLoad() { @@ -194,7 +264,7 @@ extension ReviewWriteVC { make.width.equalTo(scrollView.snp.width) } - contentView.addSubviews(restaurantTitleLabel, lineView, questionTasteLabel, tagTasteStackView, questionHelpfulLabel, tagHelpfulStackView, reviewStackView, reviewTextVeiw) + contentView.addSubviews(restaurantTitleLabel, lineView, questionTasteStackView, tagTasteStackView, questionFeelingStackView, tagHelpfulStackView, reviewStackView, reviewTextVeiw, pictureStackView) restaurantTitleLabel.snp.makeConstraints { make in make.top.equalToSuperview().inset(20) @@ -207,23 +277,23 @@ extension ReviewWriteVC { make.height.equalTo(1) } - questionTasteLabel.snp.makeConstraints { make in + questionTasteStackView.snp.makeConstraints { make in make.top.equalTo(lineView.snp.bottom).offset(24) make.leading.equalToSuperview().inset(20) } tagTasteStackView.snp.makeConstraints { make in - make.top.equalTo(questionTasteLabel.snp.bottom).offset(10) + make.top.equalTo(questionTasteStackView.snp.bottom).offset(10) make.leading.equalToSuperview().inset(20) } - questionHelpfulLabel.snp.makeConstraints { make in - make.top.equalTo(tagTasteStackView.snp.bottom).offset(24) + questionFeelingStackView.snp.makeConstraints { make in + make.top.equalTo(tagTasteStackView.snp.bottom).offset(28) make.leading.equalToSuperview().inset(20) } tagHelpfulStackView.snp.makeConstraints { make in - make.top.equalTo(questionHelpfulLabel.snp.bottom).offset(10) + make.top.equalTo(questionFeelingStackView.snp.bottom).offset(10) make.leading.equalToSuperview().inset(20) } @@ -238,7 +308,10 @@ extension ReviewWriteVC { make.height.equalTo(277) } - + pictureStackView.snp.makeConstraints { make in + make.top.equalTo(reviewTextVeiw.snp.bottom).offset(24) + make.leading.equalToSuperview().inset(20) + } } } @@ -247,6 +320,60 @@ extension ReviewWriteVC { extension ReviewWriteVC { } +//extension ReviewWriteVC: UICollectionViewDelegate, UICollectionViewDataSource{ +// func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { +// return photoModel.userSelectedImages.count + 1 +// } +// +// func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { +// let addPhotoIdentifier = AddPhotoCVC.identifier +// let listPhotoIdentifer = ListPhotoCVC.identifier +// +// switch indexPath.item { +// case Cell.addCell.rawValue: +// guard let addPhotoCell = collectionView.dequeueReusableCell(withReuseIdentifier: addPhotoIdentifier, for: indexPath) as? AddPhotoCVC else { fatalError("Failed to dequeue cell for AddPhotoCVC") } +// addPhotoCell.delegate = self +// addPhotoCell.countLabel.textColor = photoModel.userSelectedImages.count == 0 ? UIColor(named: "carrot_linegray") : UIColor(named: "carrot_text_orange") +// addPhotoCell.countLabel.text = "\(photoModel.userSelectedImages.count)" +// return addPhotoCell +// default: +// guard let listPhotoCell = collectionView.dequeueReusableCell(withReuseIdentifier: listPhotoIdentifer, for: indexPath) as? ListPhotoCVC else { fatalError("Failed to dequeue cell for ListPhotoCVC") } +// listPhotoCell.delegate = self +// listPhotoCell.indexPath = indexPath.item +// +// if photoModel.userSelectedImages.count > 0 { +// listPhotoCell.photoImageView.image = photoModel.userSelectedImages[indexPath.item - 1] +// } +// return listPhotoCell +// } +// } +//} +// +//extension ReviewWriteVC: UICollectionViewDelegateFlowLayout { +// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { +// return CGSize(width: 80, height: 80) +// } +// +// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { +// return UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15) +// } +// +// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { +// return 5 +// } +//} +// +//extension ReviewWriteVC: AddImageDelegate { +// func didPickImagesToUpload(images: [UIImage]) { +// photoModel.userSelectedImages = images +// } +//} +// +//extension ReviewWriteVC: ListPhotoCVCDelegate { +// func didPressDeleteBtn(at index: Int) { +// photoModel.userSelectedImages.remove(at: index - 1) +// } +//} extension ReviewWriteVC: UITextViewDelegate { func textViewDidBeginEditing(_ textView: UITextView) { From 57c6e9e7667931fe0f86ed5b7c3c53e0f3630b04 Mon Sep 17 00:00:00 2001 From: Choi YoungLyn Date: Wed, 13 Jul 2022 23:22:28 +0900 Subject: [PATCH 05/12] =?UTF-8?q?[Design]=20#22-=ED=83=9C=EA=B7=B8=20?= =?UTF-8?q?=EB=B2=84=ED=8A=BC,=20=ED=9B=84=EA=B8=B0=EC=9E=91=EC=84=B1=20Te?= =?UTF-8?q?xtView=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReviewWriteScene/VC/ReviewWriteVC.swift | 151 ++++++++++++++---- 1 file changed, 120 insertions(+), 31 deletions(-) diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift index 733f35a2..2067a465 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift @@ -70,25 +70,37 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { private lazy var tagGood: UIButton = { let btn = UIButton() - btn.setTitle("맛최고", for: .normal) - btn.tintColor = .helfmeBlack - btn.backgroundColor = .helfmeLineGray + btn.setTitle("# 맛 최고", for: .normal) + btn.setTitleColor(UIColor.helfmeGray2, for: UIControl.State.normal) + btn.titleLabel?.font = .NotoRegular(size: 14) + btn.backgroundColor = .helfmeWhite + btn.layer.borderColor = UIColor.helfmeGray2.cgColor + btn.layer.borderWidth = 0.5 + btn.layer.cornerRadius = 14 return btn }() private lazy var tagSoso: UIButton = { let btn = UIButton() - btn.setTitle("맛그럭저럭", for: .normal) - btn.tintColor = .helfmeBlack - btn.backgroundColor = .helfmeLineGray + btn.setTitle("#맛 그럭저럭", for: .normal) + btn.setTitleColor(UIColor.helfmeGray2, for: UIControl.State.normal) + btn.titleLabel?.font = .NotoRegular(size: 14) + btn.backgroundColor = .helfmeWhite + btn.layer.borderColor = UIColor.helfmeGray2.cgColor + btn.layer.borderWidth = 0.5 + btn.layer.cornerRadius = 14 return btn }() private lazy var tagBad: UIButton = { let btn = UIButton() - btn.setTitle("맛 별로", for: .normal) - btn.tintColor = .helfmeBlack - btn.backgroundColor = .helfmeLineGray + btn.setTitle("#맛 별로에요", for: .normal) + btn.setTitleColor(UIColor.helfmeGray2, for: UIControl.State.normal) + btn.titleLabel?.font = .NotoRegular(size: 14) + btn.backgroundColor = .helfmeWhite + btn.layer.borderColor = UIColor.helfmeGray2.cgColor + btn.layer.borderWidth = 0.5 + btn.layer.cornerRadius = 14 return btn }() @@ -126,36 +138,48 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { return sv }() - private lazy var tagDiet: UIButton = { + private lazy var tagNoBurden: UIButton = { let btn = UIButton() - btn.setTitle("다이어트용", for: .normal) - btn.tintColor = .helfmeBlack - btn.backgroundColor = .helfmeLineGray + btn.setTitle("# 약속 시 부담 없는", for: .normal) + btn.setTitleColor(UIColor.helfmeGray2, for: UIControl.State.normal) + btn.titleLabel?.font = .NotoRegular(size: 14) + btn.backgroundColor = .helfmeWhite + btn.layer.borderColor = UIColor.helfmeGray2.cgColor + btn.layer.borderWidth = 0.5 + btn.layer.cornerRadius = 14 return btn }() - private lazy var tagHealthFood: UIButton = { + private lazy var tagEasy: UIButton = { let btn = UIButton() - btn.setTitle("건강식", for: .normal) - btn.tintColor = .helfmeBlack - btn.backgroundColor = .helfmeLineGray + btn.setTitle("# 양 조절 쉬운", for: .normal) + btn.setTitleColor(UIColor.helfmeGray2, for: UIControl.State.normal) + btn.titleLabel?.font = .NotoRegular(size: 14) + btn.backgroundColor = .helfmeWhite + btn.layer.borderColor = UIColor.helfmeGray2.cgColor + btn.layer.borderWidth = 0.5 + btn.layer.cornerRadius = 14 return btn }() - private lazy var tagCheet: UIButton = { + private lazy var tagStrong: UIButton = { let btn = UIButton() - btn.setTitle("치팅데이용", for: .normal) - btn.tintColor = .helfmeBlack - btn.backgroundColor = .helfmeLineGray + btn.setTitle("# 든든한", for: .normal) + btn.setTitleColor(UIColor.helfmeGray2, for: UIControl.State.normal) + btn.titleLabel?.font = .NotoRegular(size: 14) + btn.backgroundColor = .helfmeWhite + btn.layer.borderColor = UIColor.helfmeGray2.cgColor + btn.layer.borderWidth = 0.5 + btn.layer.cornerRadius = 14 return btn }() - + private lazy var tagHelpfulStackView: UIStackView = { let sv = UIStackView() sv.axis = .horizontal sv.alignment = .center sv.spacing = 6 - sv.addArrangedSubviews(tagDiet, tagHealthFood, tagCheet) + sv.addArrangedSubviews(tagNoBurden, tagEasy, tagStrong) return sv }() @@ -184,15 +208,30 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { return sv }() - private lazy var reviewTextVeiw: UITextView = { + private let reviewView: UIView = { + let view = UIView() + view.backgroundColor = .helfmeBgGray + view.layer.cornerRadius = 8 + return view + }() + + private lazy var reviewTextView: UITextView = { let tv = UITextView() tv.text = "리뷰를 작성해주세요 (최대 500자)" + tv.font = .NotoRegular(size: 12) tv.textColor = .helfmeGray2 tv.backgroundColor = .helfmeBgGray - tv.layer.cornerRadius = 8 return tv }() + private lazy var textCountLabel: UILabel = { + let lb = UILabel() + lb.text = "0/500자" + lb.textColor = .helfmeGray2 + lb.font = .NotoRegular(size: 12) + return lb + }() + private let pictureLabel: UILabel = { let lb = UILabel() lb.text = "사진을 올려주세요" @@ -244,7 +283,7 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { extension ReviewWriteVC { private func setDelegate() { scrollView.delegate = self - reviewTextVeiw.delegate = self + reviewTextView.delegate = self } private func setNavigation() { @@ -264,7 +303,7 @@ extension ReviewWriteVC { make.width.equalTo(scrollView.snp.width) } - contentView.addSubviews(restaurantTitleLabel, lineView, questionTasteStackView, tagTasteStackView, questionFeelingStackView, tagHelpfulStackView, reviewStackView, reviewTextVeiw, pictureStackView) + contentView.addSubviews(restaurantTitleLabel, lineView, questionTasteStackView, tagTasteStackView, questionFeelingStackView, tagHelpfulStackView, reviewStackView, reviewView, pictureStackView) restaurantTitleLabel.snp.makeConstraints { make in make.top.equalToSuperview().inset(20) @@ -282,9 +321,22 @@ extension ReviewWriteVC { make.leading.equalToSuperview().inset(20) } + tagGood.snp.makeConstraints { make in + make.width.equalTo(73) + } + + tagSoso.snp.makeConstraints { make in + make.width.equalTo(99) + } + + tagBad.snp.makeConstraints { make in + make.width.equalTo(99) + } + tagTasteStackView.snp.makeConstraints { make in make.top.equalTo(questionTasteStackView.snp.bottom).offset(10) make.leading.equalToSuperview().inset(20) + make.height.equalTo(28) } questionFeelingStackView.snp.makeConstraints { make in @@ -292,27 +344,59 @@ extension ReviewWriteVC { make.leading.equalToSuperview().inset(20) } + tagNoBurden.snp.makeConstraints { make in + make.width.equalTo(131) + } + + tagEasy.snp.makeConstraints { make in + make.width.equalTo(102) + } + + tagStrong.snp.makeConstraints { make in + make.width.equalTo(70) + } + tagHelpfulStackView.snp.makeConstraints { make in make.top.equalTo(questionFeelingStackView.snp.bottom).offset(10) make.leading.equalToSuperview().inset(20) + make.height.equalTo(28) } reviewStackView.snp.makeConstraints { make in - make.top.equalTo(tagHelpfulStackView.snp.bottom).offset(24) + make.top.equalTo(tagHelpfulStackView.snp.bottom).offset(27) make.leading.equalToSuperview().inset(20) } - reviewTextVeiw.snp.makeConstraints { make in + reviewView.addSubviews(reviewTextView, textCountLabel) + + reviewView.snp.makeConstraints { make in make.top.equalTo(reviewStackView.snp.bottom).offset(10) make.leading.trailing.equalToSuperview().inset(20) - make.height.equalTo(277) + make.height.equalTo(297) + } + + reviewTextView.snp.makeConstraints { make in + make.top.bottom.equalToSuperview().inset(10) + make.leading.equalToSuperview().inset(14) + make.trailing.equalToSuperview().inset(30) } + textCountLabel.snp.makeConstraints { make in + make.bottom.equalToSuperview().inset(10) + make.trailing.equalToSuperview().inset(14) + } + pictureStackView.snp.makeConstraints { make in - make.top.equalTo(reviewTextVeiw.snp.bottom).offset(24) + make.top.equalTo(reviewTextView.snp.bottom).offset(24) make.leading.equalToSuperview().inset(20) } } + + func checkMaxLength(_ textView: UITextView) { + if (textView.text.count) > 500 { + textView.deleteBackward() + } + } } // MARK: - Network @@ -320,6 +404,7 @@ extension ReviewWriteVC { extension ReviewWriteVC { } + //extension ReviewWriteVC: UICollectionViewDelegate, UICollectionViewDataSource{ // func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { // return photoModel.userSelectedImages.count + 1 @@ -400,5 +485,9 @@ extension ReviewWriteVC: UITextViewDelegate { } } } + checkMaxLength(textView) + let count = textView.text.count + textCountLabel.text = "\(count)/500자" } } + From 0bbe7fd88cf87c69e4ff5fa75c94a3aaf0b009ff Mon Sep 17 00:00:00 2001 From: Choi YoungLyn Date: Thu, 14 Jul 2022 01:28:42 +0900 Subject: [PATCH 06/12] =?UTF-8?q?[Add]=20#22-=EB=A6=AC=EB=B7=B0=20?= =?UTF-8?q?=EC=9E=91=EC=84=B1=20=ED=99=94=EB=A9=B4=EC=97=90=20=ED=95=84?= =?UTF-8?q?=EC=9A=94=ED=95=9C=20=EC=97=90=EC=85=8B=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Global/Literals/ImageLiterals.swift | 5 ++++ .../Assets.xcassets/ReviewWrite/Contents.json | 6 +++++ .../btn_delete.imageset/Contents.json | 23 ++++++++++++++++++ .../btn_delete.imageset/Ellipse 132.png | Bin 0 -> 335 bytes .../btn_delete.imageset/Ellipse 132@2x.png | Bin 0 -> 544 bytes .../btn_delete.imageset/Ellipse 132@3x.png | Bin 0 -> 835 bytes .../icn_photoAdd.imageset/Contents.json | 23 ++++++++++++++++++ .../icn_photoAdd.imageset/Vector.png | Bin 0 -> 672 bytes .../icn_photoAdd.imageset/Vector@2x.png | Bin 0 -> 1146 bytes .../icn_photoAdd.imageset/Vector@3x.png | Bin 0 -> 1587 bytes 10 files changed, 57 insertions(+) create mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/Contents.json create mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Contents.json create mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132.png create mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132@2x.png create mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132@3x.png create mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/icn_photoAdd.imageset/Contents.json create mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/icn_photoAdd.imageset/Vector.png create mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/icn_photoAdd.imageset/Vector@2x.png create mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/icn_photoAdd.imageset/Vector@3x.png diff --git a/HealthFoodMe/HealthFoodMe/Global/Literals/ImageLiterals.swift b/HealthFoodMe/HealthFoodMe/Global/Literals/ImageLiterals.swift index 10db2e17..b450e497 100644 --- a/HealthFoodMe/HealthFoodMe/Global/Literals/ImageLiterals.swift +++ b/HealthFoodMe/HealthFoodMe/Global/Literals/ImageLiterals.swift @@ -36,4 +36,9 @@ struct ImageLiterals { static let star3Icon = UIImage(named: "icn_star_03") static let beforeIcon = UIImage(named: "icon_before") } + + struct ReviewWrite { + static let addPhotoIcon = UIImage(named: "icn_photoAdd") + static let deletePhotoBtn = UIImage(named: "btn_delete") + } } diff --git a/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/Contents.json b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/Contents.json new file mode 100644 index 00000000..73c00596 --- /dev/null +++ b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/Contents.json @@ -0,0 +1,6 @@ +{ + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Contents.json b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Contents.json new file mode 100644 index 00000000..4a601329 --- /dev/null +++ b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "Ellipse 132.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Ellipse 132@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Ellipse 132@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132.png b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132.png new file mode 100644 index 0000000000000000000000000000000000000000..4314df828dabf9f3618e61d2196b600a5ea806ef GIT binary patch literal 335 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&eB{u56Z$B+ufrIR1>9#Rl!<&SYNPhkFidH!3L zQW5hFc?sJ;EYG_jSimIF$a?EnoHLJ9vcUc&CmrA2z4&wOj9<|9nSlDbII- z=r=bDW&Guq{L~U$H?hQ}V#515%QKS}e$Wv(%6w>T$^qer*%2bv+!UF!P7r81`_?<^6>SbHoqW~o3_wW!kv z>4vXw*Strr-n-}+`2e7y2`HXi;UTG e)`t_G*)#lDnNvPF@UsTczYLzPelF{r5}E*Zg@wWZ literal 0 HcmV?d00001 diff --git a/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132@2x.png b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132@2x.png new file mode 100644 index 0000000000000000000000000000000000000000..68a3de71deceda28966943ab29aefdbc95f5a9da GIT binary patch literal 544 zcmV+*0^j|KP)` z!Y~j#i3VJP^56|r0CWHq&;lI_fp{qao{r<3Ja>6YL z>l#)&epw*G%B#4sgesBK=kF28%OXZaOk7>y1I|c%7|-S4EZ|N5DIEe=RBtDput%{GU0Qv(0rjbPyNojr~z>BaDFpng{;{KmkYlFtZ z1W~&8^WaIJpTrUDdACQ8 literal 0 HcmV?d00001 diff --git a/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132@3x.png b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..37c0ce77537e7ed8279e71b9fa0ee2228ab7da9b GIT binary patch literal 835 zcmV-J1HAl+P)rA1pt4ao}`B* zKtfOq$v9A%0L7#`lL;nodbiH1W zJs@XdNkJ$y1nxsH2Ld@#0Q~P1zcD;VnUfWW1jp^Y?9A}FU=kjo$lz2(PEw%L={(4V z1>b|aSS$v42j@}%vuf|MG4VIq`NoApzt4>Pj{*vOLOfV-rE%OB-Gr{Q zl~&3;5|g}?%}TFnt%#8wCtz_zw8%7DyY*;)$S zCkAfRGz#4(2D0}IkAI>R%1#B!+$LWX$Zj);ZBYu=u4{uow&Ja6;CzTs*x7!n# zsH&$l57nFYZbxc2ibv`sQw!ZLng@A5g0<+F%OolCssXLx;<}T|5eUxRKvcNM%Q-K5*l75o zN5AO8$89`!!bJp+D6GIPkurSUCQMb@iFo0egF(sD-~aFwI4UaiF0VEMI_+j~nCt)m N002ovPDHLkV1hncZ=e7G literal 0 HcmV?d00001 diff --git a/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/icn_photoAdd.imageset/Contents.json b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/icn_photoAdd.imageset/Contents.json new file mode 100644 index 00000000..df240cf1 --- /dev/null +++ b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/icn_photoAdd.imageset/Contents.json @@ -0,0 +1,23 @@ +{ + "images" : [ + { + "filename" : "Vector.png", + "idiom" : "universal", + "scale" : "1x" + }, + { + "filename" : "Vector@2x.png", + "idiom" : "universal", + "scale" : "2x" + }, + { + "filename" : "Vector@3x.png", + "idiom" : "universal", + "scale" : "3x" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/icn_photoAdd.imageset/Vector.png b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/icn_photoAdd.imageset/Vector.png new file mode 100644 index 0000000000000000000000000000000000000000..b3203638bb51b8725b1c761cdaa9e385bd7522a6 GIT binary patch literal 672 zcmV;R0$=@!P) z<1i3jC!Qpaz6wrMaO8I;PX`s;T?H39fC{+l;5vw@;OGGJl$rcO1*il+CYemaw?^^^ z1F~!a`DQd;$!mYoYV~P7`UK49^AL~UY_C?Uqkg|H*{;w5;k!DHMk8T+-)J=AX0sXV z{$jBRmdj+$1~wlMoZ%4~{quUgewp>FR;xE?iJcpE z5MSmImqohr@pydfd0z1BrSJa$@i~=)M2nOyRAbzsCEMd;WdZ~@#>*5Kr?P0b+aalK zP}wfnMz;S-vmFFOdWHBiz+pe3{Xk46lM~(9Y&KG_5DS#p(ui$7723x`NXp070ucU1 z=>OP!%8HCs?OiBB9`kAtzAvp->xdiM7&|LF5m$wi$kJ22hZ;)JLY$auOyVCY{dR@R zp1&a0n$YcbBhwL+SYQ&zwx5|7OYX`!)Y>_#37EKqj9zp)oontR!!KAq$q~7GuEau5 zBr8S&7sgOuIw}%(6+QSska!?_Y?;VQ2J_1FVQLPX(;ugm0P6oY8rRkh=sXhq2ra4iP~ z8|VU1jZs+~v~Fkem=1)>8)x^UAkEv6SDrn)AB98{%z;NHgBjzD==THw0000K~#7F?VH_E z<1i4%Hzo{^mkv%>0fes^o-T9%6+kKgDj-xqs34|-<0`;BF#`k1RS=bsN4~lLf^q~S zIgTYcmpH$fOqjJD>u*V`-IXcPlyH50U7MSmJCEC6UtjAhD=T5#9#BD<2`?Ij6<#KX zwA<~<)6>%uSpa9$TVG%AB%O10b+uF~l`4a_AP7wN73}!p#u7OKq6HewUR96<_>B-= zxSn**?d@&X_C8LAI`=dhd}iC2JaIM0kMUWg3Bp=9dixN)y-O2@m2f4xK@-R)uip2{ z@Q`BIg*aysqW5VG;J&}{^^HEahn;IpbNU7B-MI0eaERXH-b1`wp>#K=aRIOY<$aMizna&G!D}}+H?5>| z&{+r7YPC0LE0@cimzS3>q3*-OL!`YA;@$)u=g`o6p)A|e- zLtWn8-5r?@syx5TBG8ByKF4?fzZMo2x;WOlyu1{;>(v`L9S>2G2W)%X6rBmm0AhL(x6RMbj}!r> zWtNX;SV#zxh?6|Uo@ zK9UD)hr0F+2<|!9w<#qMeWcswQFtkTTRS(*%R`-=iwv0SEM6vE578$O-OwFFablM| zRc5S(^A4r%9TSGrL6u+gFdlSVJeQ;A=jTn`24Ejmk@13)v=o_F3v<1yb55LM;%k>i zM8*1oJmG2`7xex*h!gr-*5naq0SsqioQ9Gm_>CQv%6i3V8P5JdO)bI`|2b`Ce zd2Ltub%p#Dt zxI<&uQSrWo1YukF+Jeyc8V4!FqX^I$9-1zv{jDg(`u6PKVOgJs>AUZrU4e>sI0YB>0$6mQFwUMiOJZiw-OQ3@d*pi3hxj4#7V`@Q;%CAKpYaf^SRW z5l_bHyzwz+#Zx8RH5}O>K`+eD%R;%?{NVqIu|EQhFX3 zif${~CmKd&T130`uzO-g; z9tIFUH%o+nO2la1NONX)bp@Y<;$yXF6T)-J&6*i%p(Xkr#9415yL$?x@&nAE1w1Vz zLNr9D;G5zZT0MkkourV+XrU-{C*jCx;S!MJnPeRMX`)$Aq`w{^` zM2D3PmY0{Eq7>76^MSoLCi{E@+y!gph3PRFh#Q<`mFnxh2y!F6yu93T8At!iT^c6V zwoTIvU&<~URLvJviizd-BmzQ+e&FI(*p&bauH1WLy3r0@gddGYUnBy&iw?g$u#I6F z-|2L|$&@!S2v5Iny;1T$fZ36YGTudpn7M6C6Z??ZuzGrWYVF^#HFt)kJX4VK8$thhc>%;#>4mfBszZQ=Oi3Y;qbmBVSFZ|b zo_`(2s4imrb}w1kMIVub*$!_b6GeQB{@OMGA~jlsy1u^7%dVSVO?D6Q@E6n@x}B-8Sfz@EV*wR!<8MbEz0ypEG@XM zmzuUab%JE1uGUWO8-Zk5VYXMh96r9=>g8LOd=w9m5~e3 zKI-UC0W05)@%%82(r%Bvg>_tw4Z4)!aCjK&=}Kz#bh;YXMxiRueVJor`w}Utix_Ma zqClo2pcee{_$9)9MSoaO4112o?Qw7iJUeWMRl+Kf3N4$9(ReMp3e>Yr7h>97Hx_?x zZjQ~NxoO`he(qC&z?u9I_l>Dyz6hZwiFF@o|GpXscOkPzT9{TKiLO8rU4bOJ0!efQ zlIRLhbRS(-i4xj~ht>PFX9*;8xou24hV39TMB#FL3bN| Date: Thu, 14 Jul 2022 01:30:05 +0900 Subject: [PATCH 07/12] =?UTF-8?q?[Design]=20#22-=EB=A6=AC=EB=B7=B0=20?= =?UTF-8?q?=EC=82=AC=EC=A7=84=20=EC=B6=94=EA=B0=80=20CollectionView=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HealthFoodMe.xcodeproj/project.pbxproj | 28 ++++ .../ReviewWriteScene/Cells/AddPhotoCVC.swift | 100 ++++++++++++ .../ReviewWriteScene/Cells/ListPhotoCVC.swift | 68 ++++++++ .../ReviewWriteScene/VC/ReviewWriteVC.swift | 153 +++++++++++------- .../ViewModel/PhotoDataModel.swift | 16 ++ 5 files changed, 303 insertions(+), 62 deletions(-) create mode 100644 HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift create mode 100644 HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift create mode 100644 HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/ViewModel/PhotoDataModel.swift diff --git a/HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj b/HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj index cc5e6519..da8bb4f6 100644 --- a/HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj +++ b/HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj @@ -26,6 +26,9 @@ 695758B9287D7C0B00E36789 /* MenuTab.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 695758B8287D7C0B00E36789 /* MenuTab.storyboard */; }; 695758BD287DA4CD00E36789 /* ReviewWrite.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 695758BC287DA4CD00E36789 /* ReviewWrite.storyboard */; }; 695758BF287DA50000E36789 /* ReviewWriteVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 695758BE287DA50000E36789 /* ReviewWriteVC.swift */; }; + 695758C3287DF04400E36789 /* AddPhotoCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 695758C2287DF04400E36789 /* AddPhotoCVC.swift */; }; + 695758C5287DF08800E36789 /* ListPhotoCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 695758C4287DF08800E36789 /* ListPhotoCVC.swift */; }; + 695758C8287F1DCF00E36789 /* PhotoDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 695758C7287F1DCF00E36789 /* PhotoDataModel.swift */; }; A938BB8E287D221200B8DE07 /* Search.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A938BB8D287D221200B8DE07 /* Search.storyboard */; }; A938BB90287D222800B8DE07 /* MainDetail.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A938BB8F287D222800B8DE07 /* MainDetail.storyboard */; }; A9525F712873E1750065EB1D /* SearchVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9525F702873E1750065EB1D /* SearchVC.swift */; }; @@ -143,6 +146,9 @@ 695758B8287D7C0B00E36789 /* MenuTab.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MenuTab.storyboard; sourceTree = ""; }; 695758BC287DA4CD00E36789 /* ReviewWrite.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = ReviewWrite.storyboard; sourceTree = ""; }; 695758BE287DA50000E36789 /* ReviewWriteVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReviewWriteVC.swift; sourceTree = ""; }; + 695758C2287DF04400E36789 /* AddPhotoCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddPhotoCVC.swift; sourceTree = ""; }; + 695758C4287DF08800E36789 /* ListPhotoCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListPhotoCVC.swift; sourceTree = ""; }; + 695758C7287F1DCF00E36789 /* PhotoDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoDataModel.swift; sourceTree = ""; }; A938BB8D287D221200B8DE07 /* Search.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = Search.storyboard; sourceTree = ""; }; A938BB8F287D222800B8DE07 /* MainDetail.storyboard */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; path = MainDetail.storyboard; sourceTree = ""; }; A9525F702873E1750065EB1D /* SearchVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchVC.swift; sourceTree = ""; }; @@ -283,7 +289,9 @@ 695758BA287DA4A400E36789 /* ReviewWriteScene */ = { isa = PBXGroup; children = ( + 695758C6287F1DB400E36789 /* ViewModel */, 695758BB287DA4B700E36789 /* VC */, + 695758C1287DEFFA00E36789 /* Cells */, ); path = ReviewWriteScene; sourceTree = ""; @@ -297,6 +305,23 @@ path = VC; sourceTree = ""; }; + 695758C1287DEFFA00E36789 /* Cells */ = { + isa = PBXGroup; + children = ( + 695758C2287DF04400E36789 /* AddPhotoCVC.swift */, + 695758C4287DF08800E36789 /* ListPhotoCVC.swift */, + ); + path = Cells; + sourceTree = ""; + }; + 695758C6287F1DB400E36789 /* ViewModel */ = { + isa = PBXGroup; + children = ( + 695758C7287F1DCF00E36789 /* PhotoDataModel.swift */, + ); + path = ViewModel; + sourceTree = ""; + }; 697074FB28737D78001A607F /* MenuTabScene */ = { isa = PBXGroup; children = ( @@ -1169,6 +1194,7 @@ EBF66ADB287227F500DE0ED1 /* LaunchInstructor.swift in Sources */, EBF66B01287227F500DE0ED1 /* PostDetail.swift in Sources */, EBF66ABC287227F500DE0ED1 /* UserDefaults+.swift in Sources */, + 695758C3287DF04400E36789 /* AddPhotoCVC.swift in Sources */, EBF66AC3287227F500DE0ED1 /* UILabel+.swift in Sources */, 695758BF287DA50000E36789 /* ReviewWriteVC.swift in Sources */, EBF66AFE287227F500DE0ED1 /* makeVibrate.swift in Sources */, @@ -1203,6 +1229,7 @@ EBF66AF5287227F500DE0ED1 /* Logger.swift in Sources */, EB6A4528287664D600749582 /* ExpandableInfoTVC.swift in Sources */, EBF66ACB287227F500DE0ED1 /* String+.swift in Sources */, + 695758C8287F1DCF00E36789 /* PhotoDataModel.swift in Sources */, 69028BA82874675800373984 /* MenuView.swift in Sources */, A9E593C72874266200B0F8B5 /* SearchRecent.swift in Sources */, EBF66AF2287227F500DE0ED1 /* buttonPress.swift in Sources */, @@ -1220,6 +1247,7 @@ EB6A451128740CFF00749582 /* MainInfoTVC.swift in Sources */, EB6A44F22873BED500749582 /* MainMapViewModel.swift in Sources */, 69028BAC2874681700373984 /* MenuTabVC.swift in Sources */, + 695758C5287DF08800E36789 /* ListPhotoCVC.swift in Sources */, EBF66AE0287227F500DE0ED1 /* EventLogger.swift in Sources */, EBF66AC7287227F500DE0ED1 /* UITableView+.swift in Sources */, A9525F712873E1750065EB1D /* SearchVC.swift in Sources */, diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift new file mode 100644 index 00000000..bea305bf --- /dev/null +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift @@ -0,0 +1,100 @@ +// +// AddPhotoCVC.swift +// HealthFoodMe +// +// Created by 최영린 on 2022/07/13. +// + +import UIKit + +import SnapKit + +protocol AddImageDelegate: AnyObject { + func didPickImagesToUpload(images: [UIImage]) +} + +final class AddPhotoCVC: UICollectionViewCell, UICollectionViewRegisterable { + + // MARK: - Properties + + static var isFromNib = false + weak var delegate: AddImageDelegate? + +// var selectedAssets: [PHAsset] = [PHAsset]() + var userSelectedImages: [UIImage] = [UIImage]() + + // MARK: - UI Components + let addPhotoView: UIView = { + let view = UIView() + view.backgroundColor = .helfmeWhite + return view + }() + + lazy var addPhotoImageView: UIImageView = { + let imageView = UIImageView() + imageView.image = ImageLiterals.ReviewWrite.addPhotoIcon + return imageView + }() + + lazy var photoCountLabel: UILabel = { + let lb = UILabel() + lb.text = "0/5" + lb.textColor = .helfmeTagGray + lb.font = .NotoRegular(size: 14) + return lb + }() + + // MARK: - Life Cycle Part + + override init(frame: CGRect) { + super.init(frame: frame) + setUI() + setLayout() + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Methods + +extension AddPhotoCVC { + func setLineDot(view: UIView, color: UIColor, radius: CGFloat) { + let borderLayer = CAShapeLayer() + borderLayer.strokeColor = color.cgColor + borderLayer.lineDashPattern = [2, 2] + borderLayer.frame = view.bounds + borderLayer.fillColor = nil + borderLayer.path = UIBezierPath(roundedRect: view.bounds, cornerRadius: radius).cgPath + + view.layer.addSublayer(borderLayer) + } + + func setUI() { + setLineDot(view: addPhotoView, color: UIColor.helfmeTagGray, radius: 8) + } + + func setLayout() { + contentView.addSubview(addPhotoView) + + addPhotoView.addSubviews(addPhotoImageView, photoCountLabel) + + addPhotoView.snp.makeConstraints { make in + make.edges.equalToSuperview() + make.width.height.equalTo(105) + } + + addPhotoImageView.snp.makeConstraints { make in + make.top.equalToSuperview().inset(28) + make.centerX.equalToSuperview() + make.width.equalTo(31) + } + + photoCountLabel.snp.makeConstraints { make in + make.top.equalTo(addPhotoImageView.snp.bottom).offset(9) + make.centerX.equalToSuperview() + make.width.equalTo(22) + } + } +} diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift new file mode 100644 index 00000000..c98625eb --- /dev/null +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift @@ -0,0 +1,68 @@ +// +// ListPhotoCVC.swift +// HealthFoodMe +// +// Created by 최영린 on 2022/07/13. +// + +import UIKit + +protocol ListPhotoCVCDelegate: AnyObject { + func didPressDeleteBtn(at index: Int) +} + +final class ListPhotoCVC: UICollectionViewCell, UICollectionViewRegisterable { + + // MARK: - Properties + + static var isFromNib = false + weak var delegate: ListPhotoCVCDelegate? + var indexPath: Int = 0 + + // MARK: - UI Components + + lazy var photoImageView: UIImageView = { + let imageView = UIImageView() + imageView.image = ImageLiterals.ReviewWrite.addPhotoIcon + return imageView + }() + + private lazy var deleteBtn: UIButton = { + let btn = UIButton() + btn.setImage(ImageLiterals.ReviewWrite.deletePhotoBtn, for: .normal) + return btn + }() + + // MARK: - Life Cycle Part + + override init(frame: CGRect) { + super.init(frame: frame) + setUI() + setLayout() + } + + required init?(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } +} + +// MARK: - Methods + +extension ListPhotoCVC { + func setUI() { + + } + + func setLayout() { + contentView.addSubviews(photoImageView, deleteBtn) + + photoImageView.snp.makeConstraints { make in + make.edges.equalToSuperview() + } + + deleteBtn.snp.makeConstraints { make in + make.top.trailing.equalToSuperview().offset(7) + make.width.height.equalTo(16) + } + } +} diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift index 2067a465..83294e17 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift @@ -9,9 +9,17 @@ import UIKit import SnapKit -class ReviewWriteVC: UIViewController, UIScrollViewDelegate { +enum Cell: Int { + case addCell = 0, photoCell +} + +final class ReviewWriteVC: UIViewController, UIScrollViewDelegate { - // MARK: - Properties + private var photoModel: PhotoDataModel = PhotoDataModel() { + didSet { + photoCollectionView.reloadData() + } + } // MARK: - UI Components @@ -112,7 +120,7 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { sv.addArrangedSubviews(tagGood, tagSoso, tagBad) return sv }() - + private let questionFeelingLabel: UILabel = { let lb = UILabel() lb.text = "어떤 점이 좋았나요?" @@ -173,7 +181,7 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { btn.layer.cornerRadius = 14 return btn }() - + private lazy var tagHelpfulStackView: UIStackView = { let sv = UIStackView() sv.axis = .horizontal @@ -214,7 +222,7 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { view.layer.cornerRadius = 8 return view }() - + private lazy var reviewTextView: UITextView = { let tv = UITextView() tv.text = "리뷰를 작성해주세요 (최대 500자)" @@ -257,7 +265,7 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { return sv }() - private lazy var photoCV: UICollectionView = { + private lazy var photoCollectionView: UICollectionView = { let layout = UICollectionViewFlowLayout() layout.minimumLineSpacing = 0 layout.scrollDirection = .horizontal @@ -275,6 +283,7 @@ class ReviewWriteVC: UIViewController, UIScrollViewDelegate { setDelegate() setNavigation() setLayout() + registerCell() } } @@ -284,6 +293,8 @@ extension ReviewWriteVC { private func setDelegate() { scrollView.delegate = self reviewTextView.delegate = self + photoCollectionView.delegate = self + photoCollectionView.dataSource = self } private func setNavigation() { @@ -303,7 +314,7 @@ extension ReviewWriteVC { make.width.equalTo(scrollView.snp.width) } - contentView.addSubviews(restaurantTitleLabel, lineView, questionTasteStackView, tagTasteStackView, questionFeelingStackView, tagHelpfulStackView, reviewStackView, reviewView, pictureStackView) + contentView.addSubviews(restaurantTitleLabel, lineView, questionTasteStackView, tagTasteStackView, questionFeelingStackView, tagHelpfulStackView, reviewStackView, reviewView, pictureStackView, photoCollectionView) restaurantTitleLabel.snp.makeConstraints { make in make.top.equalToSuperview().inset(20) @@ -385,11 +396,18 @@ extension ReviewWriteVC { make.bottom.equalToSuperview().inset(10) make.trailing.equalToSuperview().inset(14) } - + pictureStackView.snp.makeConstraints { make in - make.top.equalTo(reviewTextView.snp.bottom).offset(24) + make.top.equalTo(reviewTextView.snp.bottom).offset(28) make.leading.equalToSuperview().inset(20) } + + photoCollectionView.snp.makeConstraints { make in + make.top.equalTo(pictureStackView.snp.bottom).offset(12) + make.leading.trailing.equalToSuperview() + make.height.equalTo(105) + make.bottom.equalToSuperview().inset(10) + } } func checkMaxLength(_ textView: UITextView) { @@ -397,6 +415,11 @@ extension ReviewWriteVC { textView.deleteBackward() } } + + private func registerCell() { + AddPhotoCVC.register(target: photoCollectionView) + ListPhotoCVC.register(target: photoCollectionView) + } } // MARK: - Network @@ -405,60 +428,67 @@ extension ReviewWriteVC { } -//extension ReviewWriteVC: UICollectionViewDelegate, UICollectionViewDataSource{ -// func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { -// return photoModel.userSelectedImages.count + 1 -// } -// -// func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { -// let addPhotoIdentifier = AddPhotoCVC.identifier -// let listPhotoIdentifer = ListPhotoCVC.identifier -// -// switch indexPath.item { -// case Cell.addCell.rawValue: -// guard let addPhotoCell = collectionView.dequeueReusableCell(withReuseIdentifier: addPhotoIdentifier, for: indexPath) as? AddPhotoCVC else { fatalError("Failed to dequeue cell for AddPhotoCVC") } -// addPhotoCell.delegate = self -// addPhotoCell.countLabel.textColor = photoModel.userSelectedImages.count == 0 ? UIColor(named: "carrot_linegray") : UIColor(named: "carrot_text_orange") -// addPhotoCell.countLabel.text = "\(photoModel.userSelectedImages.count)" -// return addPhotoCell -// default: -// guard let listPhotoCell = collectionView.dequeueReusableCell(withReuseIdentifier: listPhotoIdentifer, for: indexPath) as? ListPhotoCVC else { fatalError("Failed to dequeue cell for ListPhotoCVC") } -// listPhotoCell.delegate = self -// listPhotoCell.indexPath = indexPath.item -// -// if photoModel.userSelectedImages.count > 0 { -// listPhotoCell.photoImageView.image = photoModel.userSelectedImages[indexPath.item - 1] -// } -// return listPhotoCell -// } -// } -//} -// -//extension ReviewWriteVC: UICollectionViewDelegateFlowLayout { +extension ReviewWriteVC: UICollectionViewDelegate, UICollectionViewDataSource { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + return photoModel.userSelectedImages.count + 1 + } + + func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + + switch indexPath.item { + case Cell.addCell.rawValue: + guard let addPhotoCell = collectionView.dequeueReusableCell(withReuseIdentifier: AddPhotoCVC.className, for: indexPath) as? AddPhotoCVC else { fatalError("Failed to dequeue cell for AddPhotoCVC") } + addPhotoCell.delegate = self + addPhotoCell.photoCountLabel.text = "\(photoModel.userSelectedImages.count)/5" + return addPhotoCell + default: + guard let listPhotoCell = collectionView.dequeueReusableCell(withReuseIdentifier: ListPhotoCVC.className, for: indexPath) as? ListPhotoCVC else { fatalError("Failed to dequeue cell for ListPhotoCVC") } + listPhotoCell.delegate = self + listPhotoCell.indexPath = indexPath.item + + if photoModel.userSelectedImages.count > 0 { + listPhotoCell.photoImageView.image = photoModel.userSelectedImages[indexPath.item - 1] + } + return listPhotoCell + } + } +} + +extension ReviewWriteVC: UICollectionViewDelegateFlowLayout { + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { + let width = UIScreen.main.bounds.width + + let cellWidth = width * (105/375) + let cellHeight = cellWidth * (105/105) + + return CGSize(width: cellWidth, height: cellHeight) + } + // func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { -// return CGSize(width: 80, height: 80) -// } -// -// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { -// return UIEdgeInsets(top: 0, left: 15, bottom: 0, right: 15) -// } -// -// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { -// return 5 -// } -//} -// -//extension ReviewWriteVC: AddImageDelegate { -// func didPickImagesToUpload(images: [UIImage]) { -// photoModel.userSelectedImages = images +// return CGSize(width: 105, height: 105) // } -//} -// -//extension ReviewWriteVC: ListPhotoCVCDelegate { -// func didPressDeleteBtn(at index: Int) { -// photoModel.userSelectedImages.remove(at: index - 1) -// } -//} + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { + return UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20) + } + + func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, minimumLineSpacingForSectionAt section: Int) -> CGFloat { + return 10 + } +} + +extension ReviewWriteVC: AddImageDelegate { + func didPickImagesToUpload(images: [UIImage]) { + photoModel.userSelectedImages = images + } +} + +extension ReviewWriteVC: ListPhotoCVCDelegate { + func didPressDeleteBtn(at index: Int) { + photoModel.userSelectedImages.remove(at: index - 1) + } +} extension ReviewWriteVC: UITextViewDelegate { func textViewDidBeginEditing(_ textView: UITextView) { @@ -490,4 +520,3 @@ extension ReviewWriteVC: UITextViewDelegate { textCountLabel.text = "\(count)/500자" } } - diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/ViewModel/PhotoDataModel.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/ViewModel/PhotoDataModel.swift new file mode 100644 index 00000000..9d718861 --- /dev/null +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/ViewModel/PhotoDataModel.swift @@ -0,0 +1,16 @@ +// +// PhotoDataModel.swift +// HealthFoodMe +// +// Created by 최영린 on 2022/07/14. +// +import UIKit + +struct PhotoDataModel { + + var userSelectedImages: [UIImage] + + public init() { + self.userSelectedImages = [UIImage]() + } +} From 8e4d93b799ee9b7bea1630b0c749ceb1eec86176 Mon Sep 17 00:00:00 2001 From: Choi YoungLyn Date: Thu, 14 Jul 2022 01:34:51 +0900 Subject: [PATCH 08/12] =?UTF-8?q?[Add]=20#22-BSImagePicker=20=EB=9D=BC?= =?UTF-8?q?=EC=9D=B4=EB=B8=8C=EB=9F=AC=EB=A6=AC=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HealthFoodMe/Podfile | 1 + HealthFoodMe/Podfile.lock | 6 +++++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/HealthFoodMe/Podfile b/HealthFoodMe/Podfile index e2f1d165..ccf4d184 100644 --- a/HealthFoodMe/Podfile +++ b/HealthFoodMe/Podfile @@ -19,5 +19,6 @@ target 'HealthFoodMe' do pod 'Firebase/Crashlytics' pod 'Kingfisher', '~> 7.0' pod 'SwiftLint' + pod 'BSImagePicker', '~> 3.1' end diff --git a/HealthFoodMe/Podfile.lock b/HealthFoodMe/Podfile.lock index d53d2fa0..d9e986b0 100644 --- a/HealthFoodMe/Podfile.lock +++ b/HealthFoodMe/Podfile.lock @@ -1,5 +1,6 @@ PODS: - Alamofire (5.6.1) + - BSImagePicker (3.3.1) - Firebase/Core (9.2.0): - Firebase/CoreOnly - FirebaseAnalytics (~> 9.2.0) @@ -139,6 +140,7 @@ PODS: DEPENDENCIES: - Alamofire + - BSImagePicker (~> 3.1) - Firebase/Core (= 9.2.0) - Firebase/Crashlytics - Firebase/RemoteConfig @@ -155,6 +157,7 @@ DEPENDENCIES: SPEC REPOS: trunk: - Alamofire + - BSImagePicker - Firebase - FirebaseABTesting - FirebaseAnalytics @@ -184,6 +187,7 @@ SPEC REPOS: SPEC CHECKSUMS: Alamofire: 87bd8c952f9a4454320fce00d9cc3de57bcadaf5 + BSImagePicker: 0fe04b574d4d6b81093785d2af6c26227efc8428 Firebase: 4ba896cb8e5105d4b9e247e1c1b6222b548df55a FirebaseABTesting: cd1ec762a0078b46a7ce91dfe5b7b8991c2dff8f FirebaseAnalytics: af5a03a8dff7648c7b8486f6a78b1368e0268dd3 @@ -211,6 +215,6 @@ SPEC CHECKSUMS: SnapKit: 97b92857e3df3a0c71833cce143274bf6ef8e5eb SwiftLint: f80f1be7fa96d30e0aa68e58d45d4ea1ccaac519 -PODFILE CHECKSUM: 757d3007b47b7639bb530995e3cfd278cf3c68cb +PODFILE CHECKSUM: 328889e8eb35a650f9e8953209d54dc43875ba27 COCOAPODS: 1.11.3 From 231b8d5998112da29e9dc87f58cd5cf428bf1f35 Mon Sep 17 00:00:00 2001 From: Choi YoungLyn Date: Thu, 14 Jul 2022 02:52:18 +0900 Subject: [PATCH 09/12] =?UTF-8?q?[Design]=20#22-=EC=82=AC=EC=A7=84=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../btn_delete.imageset/Contents.json | 6 +- .../btn_delete.imageset/Ellipse 132.png | Bin 335 -> 0 bytes .../btn_delete.imageset/Ellipse 132@2x.png | Bin 544 -> 0 bytes .../btn_delete.imageset/Ellipse 132@3x.png | Bin 835 -> 0 bytes .../btn_delete.imageset/btn_imgdelete.png | Bin 0 -> 532 bytes .../btn_delete.imageset/btn_imgdelete@2x.png | Bin 0 -> 1031 bytes .../btn_delete.imageset/btn_imgdelete@3x.png | Bin 0 -> 1476 bytes HealthFoodMe/HealthFoodMe/Info.plist | 2 + .../ReviewWriteScene/Cells/AddPhotoCVC.swift | 4 +- .../ReviewWriteScene/Cells/ListPhotoCVC.swift | 10 ++- .../ReviewWriteScene/VC/ReviewWriteVC.swift | 72 +++++++++++++++++- 11 files changed, 87 insertions(+), 7 deletions(-) delete mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132.png delete mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132@2x.png delete mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132@3x.png create mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/btn_imgdelete.png create mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/btn_imgdelete@2x.png create mode 100644 HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/btn_imgdelete@3x.png diff --git a/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Contents.json b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Contents.json index 4a601329..e2f6041f 100644 --- a/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Contents.json +++ b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Contents.json @@ -1,17 +1,17 @@ { "images" : [ { - "filename" : "Ellipse 132.png", + "filename" : "btn_imgdelete.png", "idiom" : "universal", "scale" : "1x" }, { - "filename" : "Ellipse 132@2x.png", + "filename" : "btn_imgdelete@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "Ellipse 132@3x.png", + "filename" : "btn_imgdelete@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132.png b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132.png deleted file mode 100644 index 4314df828dabf9f3618e61d2196b600a5ea806ef..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 335 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`oCO|{#S9GG!XV7ZFl&wkP>``W z$lZxy-8q?;Kn_c~qpu?a!^VE@KZ&eB{u56Z$B+ufrIR1>9#Rl!<&SYNPhkFidH!3L zQW5hFc?sJ;EYG_jSimIF$a?EnoHLJ9vcUc&CmrA2z4&wOj9<|9nSlDbII- z=r=bDW&Guq{L~U$H?hQ}V#515%QKS}e$Wv(%6w>T$^qer*%2bv+!UF!P7r81`_?<^6>SbHoqW~o3_wW!kv z>4vXw*Strr-n-}+`2e7y2`HXi;UTG e)`t_G*)#lDnNvPF@UsTczYLzPelF{r5}E*Zg@wWZ diff --git a/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132@2x.png b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132@2x.png deleted file mode 100644 index 68a3de71deceda28966943ab29aefdbc95f5a9da..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 544 zcmV+*0^j|KP)` z!Y~j#i3VJP^56|r0CWHq&;lI_fp{qao{r<3Ja>6YL z>l#)&epw*G%B#4sgesBK=kF28%OXZaOk7>y1I|c%7|-S4EZ|N5DIEe=RBtDput%{GU0Qv(0rjbPyNojr~z>BaDFpng{;{KmkYlFtZ z1W~&8^WaIJpTrUDdACQ8 diff --git a/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132@3x.png b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/Ellipse 132@3x.png deleted file mode 100644 index 37c0ce77537e7ed8279e71b9fa0ee2228ab7da9b..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 835 zcmV-J1HAl+P)rA1pt4ao}`B* zKtfOq$v9A%0L7#`lL;nodbiH1W zJs@XdNkJ$y1nxsH2Ld@#0Q~P1zcD;VnUfWW1jp^Y?9A}FU=kjo$lz2(PEw%L={(4V z1>b|aSS$v42j@}%vuf|MG4VIq`NoApzt4>Pj{*vOLOfV-rE%OB-Gr{Q zl~&3;5|g}?%}TFnt%#8wCtz_zw8%7DyY*;)$S zCkAfRGz#4(2D0}IkAI>R%1#B!+$LWX$Zj);ZBYu=u4{uow&Ja6;CzTs*x7!n# zsH&$l57nFYZbxc2ibv`sQw!ZLng@A5g0<+F%OolCssXLx;<}T|5eUxRKvcNM%Q-K5*l75o zN5AO8$89`!!bJp+D6GIPkurSUCQMb@iFo0egF(sD-~aFwI4UaiF0VEMI_+j~nCt)m N002ovPDHLkV1hncZ=e7G diff --git a/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/btn_imgdelete.png b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/btn_imgdelete.png new file mode 100644 index 0000000000000000000000000000000000000000..f89e5b8e8fbdf9c3a8c98904d4b8f9e9fd9671e4 GIT binary patch literal 532 zcmV+v0_**WP)nNLn?$7L0Z_rnEFqU}9^N(#}-0F*7`X&`?4{%f#UYZ0X1g5DOl_fhG-*-5YTD zIRmCi3cneKyS=?{zq{RAfGhqQLX(3eNi$ItAJa6Q3xXh#4aXkZyf}{E4v1d`K;ko*umZN4!$^sog7M({eu9BV zT@jYsA%9RgNIhK<F-uQ33U@9=lZC@CgF+qS_pO=j!&`=IN3Ef2W27T~68 z==FME==hw^WmyK#^FUSAlaK4VFdB_uJRY-g4lL8BBcdc2IKV`2i>GJ_6%$-*E8HZb zk_|n7XbJTFpgp`bZUE{j)LTduG($z-*+tE+2x=YK>z+{0$rMwi?NIf5wKZJv|L_fL WNWMPYFB$Xz000080vf{B)a4I~f@l^7rsus{~rP>W!Kg|KC!9iZxhTJZ;< zu)&gaLFxh?U;-%?EM? z2>GQKnrMwc1fGA2_DCoTu;zRf(HU>UBJ!%=gz^-!KG>X7T}w*~bdfxhv-(oAOQjJ{ z9k@iB&dyF$Di!SR?n0IQ{e4ucRhfvQ)u$&)0w`vGa;v+(z7|(sUmw=j*WtzT@-ljQ zdT@SzE*&{*ZSf@K)xetjU)}0&Z*OsYe2n4YVdV397K@{!BgeK23k#T;nGu2~CMJXk z32$0kTg#?t{zec1?d|O!=x0>c=JN6qwOS41r0GMOTI)iXX{TwDml2L=Yj#iL?-cxY(oVS25uu3~R*4=PZC9>}{S- z_6TsKVi9X=YtY0zJw46J8mI_pzy};w`FmhaPEIf~G6Fx40I7}IxsWQ&&CL&G{x+gQ zMSymi`#9F~rMgD=>03pB0S!1rPESvZSU)*AiMhEsQRZ)g>ohUE8h8qzt>8~6!m)mS zeqNN9mX?I~dH&DN&WiuIj@zh0VbpW6P+12u^rBI(cCuJ6TO(vpzojr1GJ{^kE=;?% zvBRV+);p~cS65e%L1}d%a4Nws$Y!&zxo@}_zq7N0j*bo?Vq;^&^L>Q@5 zYE1WR$oIh(O{Ienr_=vC*b=?{9f>>@O9)QMn)3#H5X#{$Z~Ez)(s+#L_!kb(&vv-` z6#ICcguJKUw@%0FoZFDm6}k`Ycs(X2CMM=(^9R89w|p@hnri?6002ovPDHLkV1i>7 B*Np%G literal 0 HcmV?d00001 diff --git a/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/btn_imgdelete@3x.png b/HealthFoodMe/HealthFoodMe/Global/Resources/Assets.xcassets/ReviewWrite/btn_delete.imageset/btn_imgdelete@3x.png new file mode 100644 index 0000000000000000000000000000000000000000..a8a04f10f002c117e29793f8215b0bf5ae96a926 GIT binary patch literal 1476 zcmV;#1v~nQP)PwayT3ghr{7; zI2;Z~+B8rN@H{WWo6*L`#(v&@`S|$Q-_X#2a~X9FpYwU+^Z6tG6z}ivcYTIZCN+T| z3Ja3s2hZ{YXGsHYTjcL3q$yV70x4m5_ccW<#1t0!9SgOXv`~o()ZN|vmMjZXh5Xss z*&-!GA_B41cx*NAdG{+y2mj&W;bjum)JT@;>FIgJ;v7fecRgFN;fw*dt?b~0)^t_srF=TieyC~b}N|nI@J%^wzf8(MLHrwjDvI- zkP&l|?5T7pap3;iG;kXSX%^=L)t@*Z!!hZ1GQ>!rFz$G9uI=pXBpWn0H^=@i7O0=^ zF;50)3k27qm_d1AVS)Dc_JR){P!|ZZy}ccL&(zdZ+-A9O?5BmcK>T*{ajzX17znm_ zz>SR!ZIRa2*2>m1HZ~Tw8HPHqNfRxBU_C6*tGL$}3Wf51Utb^1&(D*Tm6esCtzva` zRnS`BinO}<_V#vk>#?&|9xKt^-5m`L4F$(|P!^aD4h~|q&*gF-xfI0N+}tDqNFx8` zZhx1AXbHrL*sr|#Lei#KEC$=b!NFh)w}WWv{8K=j+1c6hF~o^lWL&sZLZwpaHxeQi zD0Hu%NCQ|5Vu*4TSk&d^C7qm{RK0#=WQ3NMmdeLlTU)feyi7XqJ$o%JEd>_oA4xm0 zKvMUr1R@O&4^u}+M{o>F+TY)&>+9=}u7il{>+96i)D#>aA0N~7^fZ~k!TL{jv!bXC z2|;<347k0$rHP3Ny12Lqj?tq*h-hwuee_tWx5KqFGc#n0&b{jhWL(C8NRyM3Ws#!Y zzuH%V;hN~RCh)y`Bt$$G>+0${hd+}A;6~BB2yUd#10|$7Zvmfs)GkQ_u?5)@2jIb@ zK^MYAbDg=lIh*1DaV})NqA2C5o(bLg&dv^5=F<}hR2zE0z3KrSfl6c%|TgGKf@Kmnze>su~;dHhL9Sicw zkmqup=W--dFwajy!~$`hSCpz(BU;yiAh4WhBB-oM1!`L&VG#rg5s$?(nG9B3{6Lx@ z=3p$Qz-YZ%+2iW!Dj1(3hy#q>@GncV5!S5;N6tihvr&=8e)`d!C zTy)$EXbA*2|Ww(BG4Xc@EgG*g;;MyJ%~wN zr?QSDi9=XuMVc5*J%^KWZ{u7G7r{f?7-QkP1ofdscEvntVmvp`^`S$|U{ZY|uK!eG zJeuds`Wv!5fVBh`FT5l}jF-QlXW(A#Z?+=qtGi5KalZ3?{|_?6%K9MIsK~t<+%-$} z!6NrsR@N(7TVaM-%Q_LsC@5EAeU&Q~QgTTIGp}i{87i@xzd1cUeMc5aY#A`$><60# z{^#J1;)p+^Nh||SdLen9V&+Mjp!Y1;bg4?x_$vaeDKA+r6N5k)WbR)2@`c$3B7p~9(buOeQRFgXxb0RIZBnD5gP#o=%`91e%W e;cz${wdFq}yl)1^D+gr&0000 + NSPhotoLibraryUsageDescription + 리뷰를 작성하기 위해 사용자의 갤러리에 접근합니다 UIAppFonts Pretendard-Bold.otf diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift index bea305bf..896393b4 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift @@ -7,7 +7,9 @@ import UIKit +import BSImagePicker import SnapKit +import Photos protocol AddImageDelegate: AnyObject { func didPickImagesToUpload(images: [UIImage]) @@ -20,7 +22,7 @@ final class AddPhotoCVC: UICollectionViewCell, UICollectionViewRegisterable { static var isFromNib = false weak var delegate: AddImageDelegate? -// var selectedAssets: [PHAsset] = [PHAsset]() + var selectedAssets: [PHAsset] = [PHAsset]() var userSelectedImages: [UIImage] = [UIImage]() // MARK: - UI Components diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift index c98625eb..a2e60359 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift @@ -24,12 +24,14 @@ final class ListPhotoCVC: UICollectionViewCell, UICollectionViewRegisterable { lazy var photoImageView: UIImageView = { let imageView = UIImageView() imageView.image = ImageLiterals.ReviewWrite.addPhotoIcon + imageView.layer.cornerRadius = 8 return imageView }() private lazy var deleteBtn: UIButton = { let btn = UIButton() btn.setImage(ImageLiterals.ReviewWrite.deletePhotoBtn, for: .normal) + btn.addTarget(self, action: #selector(deleteBtnDidTap), for: .touchUpInside) return btn }() @@ -61,8 +63,12 @@ extension ListPhotoCVC { } deleteBtn.snp.makeConstraints { make in - make.top.trailing.equalToSuperview().offset(7) - make.width.height.equalTo(16) + make.top.trailing.equalToSuperview().inset(0) + make.width.height.equalTo(24) } } + + @objc func deleteBtnDidTap(_ sender: Any) { + delegate?.didPressDeleteBtn(at: indexPath) + } } diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift index 83294e17..64a73586 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift @@ -7,7 +7,9 @@ import UIKit +import BSImagePicker import SnapKit +import Photos enum Cell: Int { case addCell = 0, photoCell @@ -20,6 +22,8 @@ final class ReviewWriteVC: UIViewController, UIScrollViewDelegate { photoCollectionView.reloadData() } } + var selectedAssets: [PHAsset] = [PHAsset]() + var userSelectedImages: [UIImage] = [UIImage]() // MARK: - UI Components @@ -272,7 +276,7 @@ final class ReviewWriteVC: UIViewController, UIScrollViewDelegate { layout.sectionInset = .zero let cv = UICollectionView(frame: .zero, collectionViewLayout: layout) - cv.showsVerticalScrollIndicator = false + cv.showsHorizontalScrollIndicator = false return cv }() @@ -420,6 +424,71 @@ extension ReviewWriteVC { AddPhotoCVC.register(target: photoCollectionView) ListPhotoCVC.register(target: photoCollectionView) } + + @objc func showStatusActionSheet(_ sender: UITapGestureRecognizer) { + let actionSheet = UIAlertController(title: "선택", message: nil, preferredStyle: .actionSheet) + + let takePictureAction = UIAlertAction(title: "사진 찍기", style: .default) {_ in + + } + let albumAction = UIAlertAction(title: "사진 보관함", style: .default) {_ in + self.addCellDidTap() + } + let cancelAction = UIAlertAction(title: "닫기", style: .cancel, handler: nil) + + actionSheet.addAction(takePictureAction) + actionSheet.addAction(albumAction) + actionSheet.addAction(cancelAction) + + self.present(actionSheet, animated: true) + } + + func addCellDidTap() { + selectedAssets.removeAll() + userSelectedImages.removeAll() + + let imagePicker = ImagePickerController() + imagePicker.settings.selection.max = 5 + imagePicker.settings.fetch.assets.supportedMediaTypes = [.image] + + self.presentImagePicker(imagePicker, select: { (asset) in + + }, deselect: { (asset) in + + }, cancel: { (assets) in + + }, finish: { (assets) in + + for i in 0.. Date: Thu, 14 Jul 2022 20:19:56 +0900 Subject: [PATCH 10/12] =?UTF-8?q?[Design]=20#22-=EC=B9=B4=EB=A9=94?= =?UTF-8?q?=EB=9D=BC=EB=A1=9C=20=EB=A6=AC=EB=B7=B0=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=20=EC=B6=94=EA=B0=80=20UI?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HealthFoodMe/HealthFoodMe/Info.plist | 2 + .../ReviewWriteScene/Cells/AddPhotoCVC.swift | 1 + .../ReviewWriteScene/Cells/ListPhotoCVC.swift | 9 +--- .../ReviewWriteScene/VC/ReviewWriteVC.swift | 45 ++++++++++++++----- 4 files changed, 39 insertions(+), 18 deletions(-) diff --git a/HealthFoodMe/HealthFoodMe/Info.plist b/HealthFoodMe/HealthFoodMe/Info.plist index 17a43f59..b4f8fadc 100644 --- a/HealthFoodMe/HealthFoodMe/Info.plist +++ b/HealthFoodMe/HealthFoodMe/Info.plist @@ -2,6 +2,8 @@ + NSCameraUsageDescription + 리뷰 사진 촬영을 위해 시스템 카메라에 접근합니다 NSPhotoLibraryUsageDescription 리뷰를 작성하기 위해 사용자의 갤러리에 접근합니다 UIAppFonts diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift index 896393b4..e697dd79 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift @@ -26,6 +26,7 @@ final class AddPhotoCVC: UICollectionViewCell, UICollectionViewRegisterable { var userSelectedImages: [UIImage] = [UIImage]() // MARK: - UI Components + let addPhotoView: UIView = { let view = UIView() view.backgroundColor = .helfmeWhite diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift index a2e60359..f47c7e53 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift @@ -31,7 +31,7 @@ final class ListPhotoCVC: UICollectionViewCell, UICollectionViewRegisterable { private lazy var deleteBtn: UIButton = { let btn = UIButton() btn.setImage(ImageLiterals.ReviewWrite.deletePhotoBtn, for: .normal) - btn.addTarget(self, action: #selector(deleteBtnDidTap), for: .touchUpInside) + btn.addTarget(self, action: #selector(didTapDeleteButton), for: .touchUpInside) return btn }() @@ -39,7 +39,6 @@ final class ListPhotoCVC: UICollectionViewCell, UICollectionViewRegisterable { override init(frame: CGRect) { super.init(frame: frame) - setUI() setLayout() } @@ -51,10 +50,6 @@ final class ListPhotoCVC: UICollectionViewCell, UICollectionViewRegisterable { // MARK: - Methods extension ListPhotoCVC { - func setUI() { - - } - func setLayout() { contentView.addSubviews(photoImageView, deleteBtn) @@ -68,7 +63,7 @@ extension ListPhotoCVC { } } - @objc func deleteBtnDidTap(_ sender: Any) { + @objc func didTapDeleteButton(_ sender: Any) { delegate?.didPressDeleteBtn(at: indexPath) } } diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift index 64a73586..d2689884 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift @@ -426,13 +426,19 @@ extension ReviewWriteVC { } @objc func showStatusActionSheet(_ sender: UITapGestureRecognizer) { - let actionSheet = UIAlertController(title: "선택", message: nil, preferredStyle: .actionSheet) + let actionSheet = UIAlertController(title: nil, message: nil, preferredStyle: .actionSheet) let takePictureAction = UIAlertAction(title: "사진 찍기", style: .default) {_ in - + let camera = UIImagePickerController() + camera.sourceType = .camera + camera.allowsEditing = true + camera.cameraDevice = .rear + camera.cameraCaptureMode = .photo + camera.delegate = self + self.present(camera, animated: true, completion: nil) } let albumAction = UIAlertAction(title: "사진 보관함", style: .default) {_ in - self.addCellDidTap() + self.didTapimageAlbum() } let cancelAction = UIAlertAction(title: "닫기", style: .cancel, handler: nil) @@ -443,7 +449,7 @@ extension ReviewWriteVC { self.present(actionSheet, animated: true) } - func addCellDidTap() { + func didTapimageAlbum() { selectedAssets.removeAll() userSelectedImages.removeAll() @@ -498,12 +504,12 @@ extension ReviewWriteVC { } extension ReviewWriteVC: UICollectionViewDelegate, UICollectionViewDataSource { + func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { return photoModel.userSelectedImages.count + 1 } func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { - switch indexPath.item { case Cell.addCell.rawValue: guard let addPhotoCell = collectionView.dequeueReusableCell(withReuseIdentifier: AddPhotoCVC.className, for: indexPath) as? AddPhotoCVC else { fatalError("Failed to dequeue cell for AddPhotoCVC") } @@ -515,7 +521,7 @@ extension ReviewWriteVC: UICollectionViewDelegate, UICollectionViewDataSource { guard let listPhotoCell = collectionView.dequeueReusableCell(withReuseIdentifier: ListPhotoCVC.className, for: indexPath) as? ListPhotoCVC else { fatalError("Failed to dequeue cell for ListPhotoCVC") } listPhotoCell.delegate = self listPhotoCell.indexPath = indexPath.item - + if photoModel.userSelectedImages.count > 0 { listPhotoCell.photoImageView.image = photoModel.userSelectedImages[indexPath.item - 1] } @@ -535,10 +541,6 @@ extension ReviewWriteVC: UICollectionViewDelegateFlowLayout { return CGSize(width: cellWidth, height: cellHeight) } -// func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { -// return CGSize(width: 105, height: 105) -// } - func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, insetForSectionAt section: Int) -> UIEdgeInsets { return UIEdgeInsets(top: 0, left: 20, bottom: 0, right: 20) } @@ -549,8 +551,13 @@ extension ReviewWriteVC: UICollectionViewDelegateFlowLayout { } extension ReviewWriteVC: AddImageDelegate { + func didPickImagesToUpload(images: [UIImage]) { - photoModel.userSelectedImages = images + photoModel.userSelectedImages += images + } + + func didTakeImagesToUpload(image: UIImage) { + photoModel.userSelectedImages.append(image) } } @@ -590,3 +597,19 @@ extension ReviewWriteVC: UITextViewDelegate { textCountLabel.text = "\(count)/500자" } } + +extension ReviewWriteVC: UIImagePickerControllerDelegate, UINavigationControllerDelegate { + + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [UIImagePickerController.InfoKey : Any]) { + if let image = info[UIImagePickerController.InfoKey(rawValue: "UIImagePickerControllerEditedImage")] as? UIImage { + var images = [UIImage]() + images.append(image) + didPickImagesToUpload(images: images) + } + + picker.dismiss(animated: true, completion: nil) + } + func imagePickerControllerDidCancel(_ picker: UIImagePickerController) { + picker.dismiss(animated: true, completion: nil) + } +} From 3073285d5e63c5d67354d3623ea594e3eb2d63c3 Mon Sep 17 00:00:00 2001 From: Choi YoungLyn Date: Thu, 14 Jul 2022 20:57:57 +0900 Subject: [PATCH 11/12] =?UTF-8?q?[Design]=20#22-=EB=A6=AC=EB=B7=B0?= =?UTF-8?q?=EC=93=B0=EA=B8=B0=20=EB=B2=84=ED=8A=BC=20UI=20=EC=B6=94?= =?UTF-8?q?=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ReviewWriteScene/VC/ReviewWriteVC.swift | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift index d2689884..5499edbf 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift @@ -280,6 +280,25 @@ final class ReviewWriteVC: UIViewController, UIScrollViewDelegate { return cv }() + private lazy var photoSubLabel: UILabel = { + let lb = UILabel() + lb.text = "해당 가게와 무관한 사진을 첨부하면 노출 제한 처리될 수 있습니다. \n사진첨부 시 개인정보가 노출되지 않도록 유의해주세요." + lb.numberOfLines = 2 + lb.textColor = .helfmeGray2 + lb.font = .NotoRegular(size: 10) + return lb + }() + + private lazy var writeReviewButton: UIButton = { + let btn = UIButton() + btn.setTitle("리뷰 쓰기", for: .normal) + btn.setTitleColor(UIColor.helfmeWhite, for: UIControl.State.normal) + btn.titleLabel?.font = .NotoBold(size: 14) + btn.backgroundColor = .mainRed + btn.layer.cornerRadius = 22 + return btn + }() + // MARK: - View Life Cycle override func viewDidLoad() { @@ -318,7 +337,7 @@ extension ReviewWriteVC { make.width.equalTo(scrollView.snp.width) } - contentView.addSubviews(restaurantTitleLabel, lineView, questionTasteStackView, tagTasteStackView, questionFeelingStackView, tagHelpfulStackView, reviewStackView, reviewView, pictureStackView, photoCollectionView) + contentView.addSubviews(restaurantTitleLabel, lineView, questionTasteStackView, tagTasteStackView, questionFeelingStackView, tagHelpfulStackView, reviewStackView, reviewView, pictureStackView, photoCollectionView, photoSubLabel, writeReviewButton) restaurantTitleLabel.snp.makeConstraints { make in make.top.equalToSuperview().inset(20) @@ -410,6 +429,17 @@ extension ReviewWriteVC { make.top.equalTo(pictureStackView.snp.bottom).offset(12) make.leading.trailing.equalToSuperview() make.height.equalTo(105) + } + + photoSubLabel.snp.makeConstraints { make in + make.top.equalTo(photoCollectionView.snp.bottom).offset(8) + make.leading.equalToSuperview().inset(20) + } + + writeReviewButton.snp.makeConstraints { make in + make.top.equalTo(photoSubLabel.snp.bottom).offset(24) + make.leading.trailing.equalToSuperview().inset(22) + make.height.equalTo(44) make.bottom.equalToSuperview().inset(10) } } From 7f049ce9198f5740df8e9f851b602f6a28cdda22 Mon Sep 17 00:00:00 2001 From: Choi YoungLyn Date: Fri, 15 Jul 2022 01:48:43 +0900 Subject: [PATCH 12/12] =?UTF-8?q?[Refactor]=20#22-=EC=BD=94=EB=93=9C?= =?UTF-8?q?=EB=A6=AC=EB=B7=B0=EB=B0=98=EC=98=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../HealthFoodMe.xcodeproj/project.pbxproj | 18 ++++++++-------- .../ReviewWriteScene/Cells/AddPhotoCVC.swift | 4 ++-- .../ReviewWriteScene/Cells/ListPhotoCVC.swift | 17 +++++++++++---- .../ReviewWriteScene/VC/ReviewWriteVC.swift | 21 +++++++++++++------ 4 files changed, 39 insertions(+), 21 deletions(-) diff --git a/HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj b/HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj index b05187ed..8d28d2e5 100644 --- a/HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj +++ b/HealthFoodMe/HealthFoodMe.xcodeproj/project.pbxproj @@ -32,16 +32,17 @@ 69028BB02874A60E00373984 /* HeaderView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 69028BAF2874A60E00373984 /* HeaderView.swift */; }; 690AB5492875C1B200DE72D4 /* MenuDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 690AB5482875C1B200DE72D4 /* MenuDataModel.swift */; }; 695758B9287D7C0B00E36789 /* MenuTab.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 695758B8287D7C0B00E36789 /* MenuTab.storyboard */; }; - A9325274287D3065001EDF50 /* SearchResultTVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9325273287D3065001EDF50 /* SearchResultTVC.swift */; }; - A9325277287D4F10001EDF50 /* SearchResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9325276287D4F10001EDF50 /* SearchResultModel.swift */; }; - A932527E287DD261001EDF50 /* SearchResultVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A932527D287DD261001EDF50 /* SearchResultVC.swift */; }; - A9325280287DD272001EDF50 /* SearchResult.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A932527F287DD272001EDF50 /* SearchResult.storyboard */; }; - A93252AD287F09D0001EDF50 /* SearchEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A93252AC287F09D0001EDF50 /* SearchEmptyView.swift */; }; 695758BD287DA4CD00E36789 /* ReviewWrite.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 695758BC287DA4CD00E36789 /* ReviewWrite.storyboard */; }; 695758BF287DA50000E36789 /* ReviewWriteVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 695758BE287DA50000E36789 /* ReviewWriteVC.swift */; }; 695758C3287DF04400E36789 /* AddPhotoCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 695758C2287DF04400E36789 /* AddPhotoCVC.swift */; }; 695758C5287DF08800E36789 /* ListPhotoCVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = 695758C4287DF08800E36789 /* ListPhotoCVC.swift */; }; 695758C8287F1DCF00E36789 /* PhotoDataModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 695758C7287F1DCF00E36789 /* PhotoDataModel.swift */; }; + 695758CA288057D700E36789 /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = 695758C9288057D700E36789 /* Config.swift */; }; + A9325274287D3065001EDF50 /* SearchResultTVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9325273287D3065001EDF50 /* SearchResultTVC.swift */; }; + A9325277287D4F10001EDF50 /* SearchResultModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9325276287D4F10001EDF50 /* SearchResultModel.swift */; }; + A932527E287DD261001EDF50 /* SearchResultVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A932527D287DD261001EDF50 /* SearchResultVC.swift */; }; + A9325280287DD272001EDF50 /* SearchResult.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A932527F287DD272001EDF50 /* SearchResult.storyboard */; }; + A93252AD287F09D0001EDF50 /* SearchEmptyView.swift in Sources */ = {isa = PBXBuildFile; fileRef = A93252AC287F09D0001EDF50 /* SearchEmptyView.swift */; }; A938BB8E287D221200B8DE07 /* Search.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A938BB8D287D221200B8DE07 /* Search.storyboard */; }; A938BB90287D222800B8DE07 /* MainDetail.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = A938BB8F287D222800B8DE07 /* MainDetail.storyboard */; }; A9525F712873E1750065EB1D /* SearchVC.swift in Sources */ = {isa = PBXBuildFile; fileRef = A9525F702873E1750065EB1D /* SearchVC.swift */; }; @@ -144,7 +145,6 @@ FD58291A287DC39A00CE62E8 /* mapContainerViewDelegateProxy.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD582917287DC39A00CE62E8 /* mapContainerViewDelegateProxy.swift */; }; FD58291B287DC39A00CE62E8 /* mapContainerView + Reactive.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD582918287DC39A00CE62E8 /* mapContainerView + Reactive.swift */; }; FD58291C287DC39A00CE62E8 /* mapContainerView.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD582919287DC39A00CE62E8 /* mapContainerView.swift */; }; - FD89904F287DC4F400144E07 /* Config.swift in Sources */ = {isa = PBXBuildFile; fileRef = FD89904E287DC4F400144E07 /* Config.swift */; }; FDA54A3B287DEAB2009D5BCE /* CustomSegementControl.swift in Sources */ = {isa = PBXBuildFile; fileRef = FDA54A3A287DEAB2009D5BCE /* CustomSegementControl.swift */; }; /* End PBXBuildFile section */ @@ -182,6 +182,7 @@ 695758C2287DF04400E36789 /* AddPhotoCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddPhotoCVC.swift; sourceTree = ""; }; 695758C4287DF08800E36789 /* ListPhotoCVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ListPhotoCVC.swift; sourceTree = ""; }; 695758C7287F1DCF00E36789 /* PhotoDataModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PhotoDataModel.swift; sourceTree = ""; }; + 695758C9288057D700E36789 /* Config.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = Config.swift; path = ../../../../../../../../Downloads/Config.swift; sourceTree = ""; }; A9325273287D3065001EDF50 /* SearchResultTVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultTVC.swift; sourceTree = ""; }; A9325276287D4F10001EDF50 /* SearchResultModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultModel.swift; sourceTree = ""; }; A932527D287DD261001EDF50 /* SearchResultVC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SearchResultVC.swift; sourceTree = ""; }; @@ -291,7 +292,6 @@ FD582917287DC39A00CE62E8 /* mapContainerViewDelegateProxy.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = mapContainerViewDelegateProxy.swift; sourceTree = ""; }; FD582918287DC39A00CE62E8 /* mapContainerView + Reactive.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "mapContainerView + Reactive.swift"; sourceTree = ""; }; FD582919287DC39A00CE62E8 /* mapContainerView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = mapContainerView.swift; sourceTree = ""; }; - FD89904E287DC4F400144E07 /* Config.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Config.swift; sourceTree = ""; }; FDA54A3A287DEAB2009D5BCE /* CustomSegementControl.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CustomSegementControl.swift; sourceTree = ""; }; /* End PBXFileReference section */ @@ -1046,7 +1046,7 @@ EBF66A8B287227F500DE0ED1 /* Environment */ = { isa = PBXGroup; children = ( - FD89904E287DC4F400144E07 /* Config.swift */, + 695758C9288057D700E36789 /* Config.swift */, EBF66A8C287227F500DE0ED1 /* NetworkConstants.swift */, ); path = Environment; @@ -1316,7 +1316,6 @@ EBF66AFF287227F500DE0ED1 /* makeAlert.swift in Sources */, EBF66AF3287227F500DE0ED1 /* applyShadow.swift in Sources */, EB6A44D628737CC400749582 /* MainDetailEntity.swift in Sources */, - FD89904F287DC4F400144E07 /* Config.swift in Sources */, EB6A4515287425F900749582 /* DetailTabTVC.swift in Sources */, EBF66AE5287227F500DE0ED1 /* NetworkConstants.swift in Sources */, EB6A44F32873BED500749582 /* MainMapEntity.swift in Sources */, @@ -1423,6 +1422,7 @@ A9325277287D4F10001EDF50 /* SearchResultModel.swift in Sources */, EBF66AC0287227F500DE0ED1 /* UIView+.swift in Sources */, EBF66B02287227F500DE0ED1 /* NoData.swift in Sources */, + 695758CA288057D700E36789 /* Config.swift in Sources */, EB6A44F02873BED500749582 /* MainMapModel.swift in Sources */, EB6A44EF2873BED500749582 /* MainMapRepository.swift in Sources */, EBF66AC9287227F500DE0ED1 /* UIColor+.swift in Sources */, diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift index e697dd79..94b9b547 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/AddPhotoCVC.swift @@ -6,10 +6,10 @@ // import UIKit +import Photos import BSImagePicker import SnapKit -import Photos protocol AddImageDelegate: AnyObject { func didPickImagesToUpload(images: [UIImage]) @@ -85,7 +85,7 @@ extension AddPhotoCVC { addPhotoView.snp.makeConstraints { make in make.edges.equalToSuperview() - make.width.height.equalTo(105) +// make.width.height.equalTo(105) } addPhotoImageView.snp.makeConstraints { make in diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift index f47c7e53..087589d6 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/Cells/ListPhotoCVC.swift @@ -23,8 +23,9 @@ final class ListPhotoCVC: UICollectionViewCell, UICollectionViewRegisterable { lazy var photoImageView: UIImageView = { let imageView = UIImageView() - imageView.image = ImageLiterals.ReviewWrite.addPhotoIcon - imageView.layer.cornerRadius = 8 +// imageView.image = ImageLiterals.ReviewWrite.addPhotoIcon + imageView.contentMode = .scaleAspectFill + imageView.layer.masksToBounds = true return imageView }() @@ -45,20 +46,28 @@ final class ListPhotoCVC: UICollectionViewCell, UICollectionViewRegisterable { required init?(coder aDecoder: NSCoder) { fatalError("init(coder:) has not been implemented") } + } // MARK: - Methods extension ListPhotoCVC { + + func setImage(_ image: UIImage) { + photoImageView.image = image + } + func setLayout() { contentView.addSubviews(photoImageView, deleteBtn) photoImageView.snp.makeConstraints { make in make.edges.equalToSuperview() } - + photoImageView.layer.cornerRadius = 8 + photoImageView.layer.masksToBounds = true deleteBtn.snp.makeConstraints { make in - make.top.trailing.equalToSuperview().inset(0) + make.top.equalToSuperview().offset(3) + make.trailing.equalToSuperview().inset(2) make.width.height.equalTo(24) } } diff --git a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift index 5499edbf..f61ec393 100644 --- a/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift +++ b/HealthFoodMe/HealthFoodMe/Presentation/Detail/ReviewWriteScene/VC/ReviewWriteVC.swift @@ -546,6 +546,15 @@ extension ReviewWriteVC: UICollectionViewDelegate, UICollectionViewDataSource { addPhotoCell.delegate = self addPhotoCell.photoCountLabel.text = "\(photoModel.userSelectedImages.count)/5" addPhotoCell.addGestureRecognizer(UITapGestureRecognizer(target: self, action: #selector(showStatusActionSheet(_:)))) + + let borderLayer = CAShapeLayer() + borderLayer.strokeColor = UIColor.helfmeTagGray.cgColor + borderLayer.lineDashPattern = [4, 4] + borderLayer.fillColor = nil + borderLayer.path = UIBezierPath(roundedRect: addPhotoCell.contentView.bounds, + cornerRadius: 8).cgPath + addPhotoCell.layer.addSublayer(borderLayer) + return addPhotoCell default: guard let listPhotoCell = collectionView.dequeueReusableCell(withReuseIdentifier: ListPhotoCVC.className, for: indexPath) as? ListPhotoCVC else { fatalError("Failed to dequeue cell for ListPhotoCVC") } @@ -553,8 +562,11 @@ extension ReviewWriteVC: UICollectionViewDelegate, UICollectionViewDataSource { listPhotoCell.indexPath = indexPath.item if photoModel.userSelectedImages.count > 0 { - listPhotoCell.photoImageView.image = photoModel.userSelectedImages[indexPath.item - 1] + listPhotoCell.setImage(photoModel.userSelectedImages[indexPath.item - 1]) } + listPhotoCell.layer.cornerRadius = 8 + listPhotoCell.layer.masksToBounds = true + listPhotoCell.contentView.clipsToBounds = true return listPhotoCell } } @@ -563,11 +575,8 @@ extension ReviewWriteVC: UICollectionViewDelegate, UICollectionViewDataSource { extension ReviewWriteVC: UICollectionViewDelegateFlowLayout { func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { - let width = UIScreen.main.bounds.width - - let cellWidth = width * (105/375) - let cellHeight = cellWidth * (105/105) - + let cellWidth = 105 + let cellHeight = 105 return CGSize(width: cellWidth, height: cellHeight) }