From 60d3deef355c00afc78b06387cf3de33da74dd3b Mon Sep 17 00:00:00 2001 From: pcsoyeon Date: Sat, 22 May 2021 17:48:59 +0900 Subject: [PATCH] =?UTF-8?q?[FIX]=20=EA=B1=B0=EB=9E=98=EC=86=8C=20=EB=A0=88?= =?UTF-8?q?=EC=9D=B4=EC=95=84=EC=9B=83=20=EC=98=A4=EB=A5=98=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Coinone-iOS/Coinone-iOS/Resource/Info.plist | 14 +- .../Storyboards/Base.lproj/Main.storyboard | 6 +- .../Source/ViewControllers/GeoraesoVC.swift | 425 ++++-------------- 3 files changed, 96 insertions(+), 349 deletions(-) diff --git a/Coinone-iOS/Coinone-iOS/Resource/Info.plist b/Coinone-iOS/Coinone-iOS/Resource/Info.plist index d951091..f5f3b74 100644 --- a/Coinone-iOS/Coinone-iOS/Resource/Info.plist +++ b/Coinone-iOS/Coinone-iOS/Resource/Info.plist @@ -2,11 +2,6 @@ - NSAppTransportSecurity - - NSAllowsArbitraryLoads - - CFBundleDevelopmentRegion $(DEVELOPMENT_LANGUAGE) CFBundleExecutable @@ -25,6 +20,11 @@ 1 LSRequiresIPhoneOS + NSAppTransportSecurity + + NSAllowsArbitraryLoads + + UIAppFonts NotoSansKR-Black.otf @@ -48,7 +48,7 @@ UISceneDelegateClassName $(PRODUCT_MODULE_NAME).SceneDelegate UISceneStoryboardFile - Main + Georaeso @@ -58,7 +58,7 @@ UILaunchStoryboardName LaunchScreen UIMainStoryboardFile - Main + Georaeso UIRequiredDeviceCapabilities armv7 diff --git a/Coinone-iOS/Coinone-iOS/Resource/Storyboards/Base.lproj/Main.storyboard b/Coinone-iOS/Coinone-iOS/Resource/Storyboards/Base.lproj/Main.storyboard index 6f3c60d..5784d8b 100644 --- a/Coinone-iOS/Coinone-iOS/Resource/Storyboards/Base.lproj/Main.storyboard +++ b/Coinone-iOS/Coinone-iOS/Resource/Storyboards/Base.lproj/Main.storyboard @@ -1,10 +1,8 @@ - - - + - + diff --git a/Coinone-iOS/Coinone-iOS/Source/ViewControllers/GeoraesoVC.swift b/Coinone-iOS/Coinone-iOS/Source/ViewControllers/GeoraesoVC.swift index bc9f22e..aef6e4a 100644 --- a/Coinone-iOS/Coinone-iOS/Source/ViewControllers/GeoraesoVC.swift +++ b/Coinone-iOS/Coinone-iOS/Source/ViewControllers/GeoraesoVC.swift @@ -4,18 +4,18 @@ // // Created by soyeon on 2021/05/15. // + import UIKit import SnapKit class GeoraesoVC: UIViewController { - private var stockList: [StockModel] = [] var menuTitles: [String] = ["마이", "거래소", "간편구매", "정보"] // MARK: - Header UI private lazy var headerView: UIView = { let view = UIView() - view.backgroundColor = .clear + view.backgroundColor = .white return view }() @@ -35,7 +35,7 @@ class GeoraesoVC: UIViewController { return button }() - + // MARK: - CollectionView lazy var topCollectionView: UICollectionView = { let layout = UICollectionViewFlowLayout() layout.scrollDirection = .horizontal @@ -44,44 +44,16 @@ class GeoraesoVC: UIViewController { collectionView.isScrollEnabled = false collectionView.translatesAutoresizingMaskIntoConstraints = false collectionView.backgroundColor = .clear + + collectionView.delegate = self + collectionView.dataSource = self return collectionView }() - private lazy var myLabel: UILabel = { - let label = UILabel() - label.text = "마이" - label.font = UIFont(name: "NotoSansKR-Bold", size: 16) - label.textColor = UIColor.textGray - return label - }() - private lazy var marketLabel: UILabel = { - let label = UILabel() - label.text = "거래소" - label.font = UIFont(name: "NotoSansKR-Bold", size: 16) - label.textColor = UIColor.black - return label - }() - private lazy var easyTransLabel: UILabel = { - let label = UILabel() - label.text = "간편 구매" - label.font = UIFont(name: "NotoSansKR-Bold", size: 16) - label.textColor = UIColor.textGray - return label - }() - private lazy var infoLabel: UILabel = { - let label = UILabel() - label.text = "정보" - label.font = UIFont(name: "NotoSansKR-Bold", size: 16) - label.textColor = UIColor.textGray - return label - }() - private lazy var lineView: UIView = { - let view = UIView() - view.backgroundColor = .black - return view - }() - // MARK: - CoinFilter Button UI + + // MARK: - Filter UI + // coin filter button private lazy var coinView: UIView = { let view = UIView() view.backgroundColor = .white @@ -117,7 +89,7 @@ class GeoraesoVC: UIViewController { return button }() - // MARK: - CurValueFilter Button UI + // curvalue filter button private lazy var curValueView: UIView = { let view = UIView() view.backgroundColor = .white @@ -154,7 +126,7 @@ class GeoraesoVC: UIViewController { return button }() - // MARK: - RateFilterView UI + // rate filter button private lazy var rateView: UIView = { let view = UIView() view.backgroundColor = .white @@ -191,7 +163,7 @@ class GeoraesoVC: UIViewController { return button }() - // MARK: - TransPriceFilterView UI + // trans price filter button private lazy var transPriceView: UIView = { let view = UIView() view.backgroundColor = .white @@ -295,71 +267,56 @@ class GeoraesoVC: UIViewController { setConfigure() setDummyData() - - topCollectionView.delegate = self - topCollectionView.dataSource = self - register() - - } - cFilterButton.snp.makeConstraints { make in - make.centerY.equalTo(coinLabel) - make.leading.equalTo(coinLabel.snp.trailing).inset(-38) } - return view - }() - private lazy var coinLabel: UILabel = { - let label = UILabel() - label.text = "코인명" - label.font = UIFont(name: "NotoSansKR-Bold", size: 12) - label.textColor = UIColor.textGray - return label - }() - private lazy var cFilterButton: UIButton = { - let button = UIButton() - button.setImage(UIImage(named: "switch"), for: .normal) - button.setPreferredSymbolConfiguration(.init(pointSize: 20, - weight: .light, - scale: .large), - forImageIn: .normal) - return button - }() - - // curvalue filter button - private lazy var curValueView: UIView = { - let view = UIView() - view.backgroundColor = .white - view.setBorder(borderColor: nil, borderWidth: nil) - view.addSubview(curValueLabel) - view.addSubview(vFilterButton) - - curValueLabel.snp.makeConstraints { make in - make.top.equalTo(view.snp.top).inset(6) - make.leading.equalTo(view.snp.leading).inset(8) - } - vFilterButton.snp.makeConstraints { make in - make.centerY.equalTo(curValueLabel) - make.leading.equalTo(curValueLabel.snp.trailing).inset(-38) + // MARK: - DummyData + func setDummyData() { + stockList.append(contentsOf: [ + StockModel(logoImage: "", + title: "XRP", + subTitle: "리플", + curValue: "1,625", + rate: "-0.37%", + transPrice: 2059), + StockModel(logoImage: "", + title: "XRP", + subTitle: "리플", + curValue: "1,500", + rate: "-0.37%", + transPrice: 2489), + StockModel(logoImage: "", + title: "XRP", + subTitle: "리플", + curValue: "1,000", + rate: "-0.37%", + transPrice: 1280)]) } +} + +// MARK: - UI +extension GeoraesoVC { + private func setConfigure() { + setHeaderView() + setTableView() + } private func register() { - self.topCollectionView.register(TopMenuCollectionViewCell.self, forCellWithReuseIdentifier: TopMenuCollectionViewCell.identifier) + self.topCollectionView.register(TopMenuCollectionViewCell.self, forCellWithReuseIdentifier: TopMenuCollectionViewCell.identifier) } private func setHeaderView() { view.addSubview(headerView) - headerView.addSubview(logoImage) - headerView.addSubview(searchButton) + view.addSubview(logoImage) + view.addSubview(searchButton) - headerView.addSubview(topCollectionView) - + view.addSubview(topCollectionView) - headerView.addSubview(coinView) - headerView.addSubview(curValueView) - headerView.addSubview(rateView) - headerView.addSubview(transPriceView) + view.addSubview(coinView) + view.addSubview(curValueView) + view.addSubview(rateView) + view.addSubview(transPriceView) headerView.snp.makeConstraints { make in make.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) @@ -376,9 +333,9 @@ class GeoraesoVC: UIViewController { } topCollectionView.snp.makeConstraints { make in - make.top.equalTo(logoImage).inset(20) - make.leading.equalTo(headerView).inset(20) - make.trailing.equalTo(headerView).inset(131) + make.top.equalTo(view).inset(20) + make.leading.equalTo(view).inset(20) + make.trailing.equalTo(view).inset(131) make.height.equalTo(30) } @@ -409,273 +366,65 @@ class GeoraesoVC: UIViewController { } } - return view - }() - private lazy var transPriceLabel: UILabel = { - let label = UILabel() - label.text = "거래대금" - label.font = UIFont(name: "NotoSansKR-Bold", size: 12) - label.textColor = UIColor(red: 101.0 / 255.0, green: 101.0 / 255.0, blue: 101.0 / 255.0, alpha: 1.0) - return label - }() - private lazy var pFilterButton: UIButton = { - let button = UIButton() - button.setImage(UIImage(named: "switch"), for: .normal) - button.setPreferredSymbolConfiguration(.init(pointSize: 20, - weight: .light, - scale: .large), - forImageIn: .normal) - - return button - }() - - - // MARK: - Table View - private lazy var tableView: UITableView = { - let tableView = UITableView(frame: .zero, style: .plain) - tableView.delegate = self - tableView.dataSource = self - - tableView.backgroundColor = .tableViewGray - tableView.tableFooterView = UIView(frame: .zero) - - tableView.register(StockTVC.self, forCellReuseIdentifier: StockTVC.identifier) - - return tableView - }() - - // MARK: - Table Header View - private lazy var tableHeaderView: UIView = { - let view = UIView() - - view.backgroundColor = .tableViewGray - - view.addSubview(tableHeaderLabel) - view.addSubview(foldListButton) - - tableHeaderLabel.snp.makeConstraints { make in - make.leading.equalTo(view.snp.leading).inset(20) - make.centerY.equalTo(view.snp.centerY) - } - foldListButton.snp.makeConstraints { make in - make.trailing.equalTo(view.snp.trailing).inset(20) - make.centerY.equalTo(view.snp.centerY) - make.width.equalTo(10) - make.height.equalTo(6) + private func setTableView() { + view.addSubview(tableView) + + tableView.snp.makeConstraints { make in + make.top.equalTo(headerView.snp.bottom) + make.leading.trailing.equalTo(view.safeAreaLayoutGuide) + make.bottom.equalToSuperview() + } } - return view - }() - - private var tableHeaderLabel: UILabel = { - let label = UILabel() - label.text = "Main Market" - label.font = UIFont.init(name: "NotoSansKR-Bold", size: 12) - label.textColor = UIColor(red: 101.0 / 255.0, green: 101.0 / 255.0, blue: 101.0 / 255.0, alpha: 1.0) - - - return label - }() - private let foldListButton: UIButton = { - let button = UIButton() - button.setImage(UIImage(systemName: "chevron.up"), for: .normal) - button.setPreferredSymbolConfiguration(.init(pointSize: 20, - weight: .light, - scale: .large), - forImageIn: .normal) - button.tintColor = .textGray - button.addTarget(self, action: #selector(foldList(_:)), for: .touchUpInside) - return button - }() - - - override func viewDidLoad() { - super.viewDidLoad() - - setConfigure() - setDummyData() - } - - // MARK: - DummyData - func setDummyData() { - stockList.append(contentsOf: [ - StockModel(logoImage: "", - title: "XRP", - subTitle: "리플", - curValue: "1,625", - rate: "-0.37%", - transPrice: 2059), - StockModel(logoImage: "", - title: "XRP", - subTitle: "리플", - curValue: "1,500", - rate: "-0.37%", - transPrice: 2489), - StockModel(logoImage: "", - title: "XRP", - subTitle: "리플", - curValue: "1,000", - rate: "-0.37%", - transPrice: 1280)]) - } } -// MARK: - UI -extension GeoraesoVC { - private func setConfigure() { - setHeaderView() - setTableView() - } - - private func setHeaderView() { - view.addSubview(headerView) - - view.addSubview(logoImage) - view.addSubview(searchButton) - - view.addSubview(myLabel) - view.addSubview(myButton) - view.addSubview(marketLabel) - view.addSubview(lineView) - view.addSubview(easyTransLabel) - view.addSubview(infoLabel) - - view.addSubview(coinView) - view.addSubview(curValueView) - view.addSubview(rateView) - view.addSubview(transPriceView) - - - headerView.snp.makeConstraints { make in - make.top.leading.trailing.equalTo(view.safeAreaLayoutGuide) - make.height.equalTo(140) - } - - logoImage.snp.makeConstraints { make in - make.top.equalTo(headerView.snp.top).inset(20) - make.leading.equalTo(headerView.snp.leading).inset(20) - } - searchButton.snp.makeConstraints { make in - make.top.equalTo(headerView.snp.top).inset(20) - make.leading.equalTo(headerView.snp.leading).inset(339) +// MARK: - TableViewDelegate +extension GeoraesoVC: UITableViewDelegate { + func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { + tableHeaderView } - // MARK: - Header Tab Constraints - myLabel.snp.makeConstraints { make in - make.top.equalTo(headerView.snp.top).inset(51) - make.leading.equalTo(headerView.snp.leading).inset(20) - } - myButton.snp.makeConstraints { make in - make.edges.equalTo(self.myLabel.snp.edges) - - } - marketLabel.snp.makeConstraints { make in - make.top.equalTo(headerView.snp.top).inset(51) - make.leading.equalTo(headerView.snp.leading).inset(70) - } - lineView.snp.makeConstraints { make in - make.top.equalTo(headerView.snp.top).inset(78) - make.centerX.equalTo(marketLabel) - make.width.equalTo(48) - make.height.equalTo(2) - } - easyTransLabel.snp.makeConstraints { make in - make.top.equalTo(headerView.snp.top).inset(51) - make.leading.equalTo(headerView.snp.leading).inset(135) - } - infoLabel.snp.makeConstraints { make in - make.top.equalTo(headerView.snp.top).inset(51) - make.leading.equalTo(headerView.snp.leading).inset(214) + func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { + 20 } - // MARK: - Filter Button Constraints - coinView.snp.makeConstraints { make in - make.top.equalTo(headerView.snp.top).inset(96) - make.leading.equalTo(headerView.snp.leading).inset(20) - make.width.equalTo(94) - make.height.equalTo(30) - } - curValueView.snp.makeConstraints { make in - make.top.equalTo(headerView.snp.top).inset(96) - make.leading.equalTo(headerView.snp.leading).inset(118) - make.width.equalTo(94) - make.height.equalTo(30) - } - rateView.snp.makeConstraints { make in - make.top.equalTo(headerView.snp.top).inset(96) - make.leading.equalTo(headerView.snp.leading).inset(216) - make.width.equalTo(66) - make.height.equalTo(30) + func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { + return 72 } - transPriceView.snp.makeConstraints { make in - make.top.equalTo(headerView.snp.top).inset(96) - make.leading.equalTo(headerView.snp.leading).inset(286) - make.width.equalTo(70) - make.height.equalTo(30) - } - } - - private func setTableView() { - view.addSubview(tableView) - tableView.snp.makeConstraints { make in - make.top.equalTo(headerView.snp.bottom) - make.leading.trailing.equalTo(view.safeAreaLayoutGuide) - make.bottom.equalToSuperview() + @objc func foldList(_ sender: UIButton) { + print("fold button touched") + + // TODO: - fold list action } - } - -} - -// MARK: - TableViewDelegate -extension GeoraesoVC: UITableViewDelegate { - func tableView(_ tableView: UITableView, viewForHeaderInSection section: Int) -> UIView? { - tableHeaderView - } - - func tableView(_ tableView: UITableView, heightForHeaderInSection section: Int) -> CGFloat { - 20 - } - - func tableView(_ tableView: UITableView, heightForRowAt indexPath: IndexPath) -> CGFloat { - return 72 - } - - @objc func foldList(_ sender: UIButton) { - print("fold button touched") - // TODO: - fold list action - } - } // MARK: - TableViewDataSource extension GeoraesoVC: UITableViewDataSource { - func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { - return stockList.count - } - - func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { - guard let cell = tableView.dequeueReusableCell(withIdentifier: StockTVC.identifier) as? StockTVC else { - return UITableViewCell() + func tableView(_ tableView: UITableView, numberOfRowsInSection section: Int) -> Int { + return stockList.count } - cell.contentView.backgroundColor = .tableViewGray - let data = stockList[indexPath.row] - cell.setData(logoPath: data.title, title: data.title, subTitle: data.subTitle, curValue: data.curValue, rate: data.rate, transPrice: data.transPrice) - return cell - } - + func tableView(_ tableView: UITableView, cellForRowAt indexPath: IndexPath) -> UITableViewCell { + guard let cell = tableView.dequeueReusableCell(withIdentifier: StockTVC.identifier) as? StockTVC else { + return UITableViewCell() + } + cell.contentView.backgroundColor = .tableViewGray + + let data = stockList[indexPath.row] + cell.setData(logoPath: data.title, title: data.title, subTitle: data.subTitle, curValue: data.curValue, rate: data.rate, transPrice: data.transPrice) + return cell + } } - - extension UITableView { + +extension UITableView { func removeExtraCellLines() { - tableFooterView = UIView(frame: .zero) + tableFooterView = UIView(frame: .zero) } } - extension GeoraesoVC: UICollectionViewDelegateFlowLayout { func collectionView(_ collectionView: UICollectionView, layout collectionViewLayout: UICollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> CGSize { let width: CGFloat