diff --git a/iOSProject/pyunrihae/pyunrihae.xcodeproj/project.pbxproj b/iOSProject/pyunrihae/pyunrihae.xcodeproj/project.pbxproj index 5dd39137..de074fb6 100644 --- a/iOSProject/pyunrihae/pyunrihae.xcodeproj/project.pbxproj +++ b/iOSProject/pyunrihae/pyunrihae.xcodeproj/project.pbxproj @@ -41,7 +41,6 @@ 989FA79C1F511E59001D1E42 /* ReviewPopupView.xib in Resources */ = {isa = PBXBuildFile; fileRef = 989FA79B1F511E59001D1E42 /* ReviewPopupView.xib */; }; 989FA7A01F52BEC8001D1E42 /* Popup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 989FA79F1F52BEC8001D1E42 /* Popup.swift */; }; 989FA7A41F52E2BA001D1E42 /* ic_check.png in Resources */ = {isa = PBXBuildFile; fileRef = 989FA7A31F52E2BA001D1E42 /* ic_check.png */; }; - 989FA7A61F53DAA0001D1E42 /* Segue.swift in Sources */ = {isa = PBXBuildFile; fileRef = 989FA7A51F53DAA0001D1E42 /* Segue.swift */; }; 989FA7A81F53EA9A001D1E42 /* empty_star.png in Resources */ = {isa = PBXBuildFile; fileRef = 989FA7A71F53EA9A001D1E42 /* empty_star.png */; }; 98B288601F53EF43007673FF /* ic_default_product.png in Resources */ = {isa = PBXBuildFile; fileRef = 98B2885F1F53EF43007673FF /* ic_default_product.png */; }; 98B394861F4D59190071BB8B /* ProductAllergyViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98B394851F4D59190071BB8B /* ProductAllergyViewController.swift */; }; @@ -189,10 +188,7 @@ 989FA79B1F511E59001D1E42 /* ReviewPopupView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ReviewPopupView.xib; sourceTree = ""; }; 989FA79F1F52BEC8001D1E42 /* Popup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Popup.swift; sourceTree = ""; }; 989FA7A31F52E2BA001D1E42 /* ic_check.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ic_check.png; sourceTree = ""; }; - - 989FA7A51F53DAA0001D1E42 /* Segue.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Segue.swift; sourceTree = ""; }; 989FA7A71F53EA9A001D1E42 /* empty_star.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = empty_star.png; sourceTree = ""; }; - 98B2885F1F53EF43007673FF /* ic_default_product.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ic_default_product.png; sourceTree = ""; }; 98B394851F4D59190071BB8B /* ProductAllergyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductAllergyViewController.swift; sourceTree = ""; }; 98B394871F4E5EDA0071BB8B /* MainProduct.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainProduct.xib; sourceTree = ""; }; @@ -412,7 +408,6 @@ isa = PBXGroup; children = ( 9865E54D1F3C576D00014795 /* Image.swift */, - 989FA7A51F53DAA0001D1E42 /* Segue.swift */, 9865E5071F3943BD00014795 /* Button.swift */, 9865E5231F3AE04C00014795 /* Label.swift */, 989FA79F1F52BEC8001D1E42 /* Popup.swift */, @@ -952,7 +947,6 @@ 98F865A51F442B3800C2F333 /* LoginSignUpViewController.swift in Sources */, 98D9F2E31F418DF3009D0E10 /* YNSearch.swift in Sources */, 98DED89B1F41729100CC4D63 /* SearchViewController.swift in Sources */, - 989FA7A61F53DAA0001D1E42 /* Segue.swift in Sources */, 9865E4F61F387C7A00014795 /* TabBarViewController.swift in Sources */, 9865E52C1F3AF3EE00014795 /* MypageTableViewCell.swift in Sources */, 98B394861F4D59190071BB8B /* ProductAllergyViewController.swift in Sources */, diff --git a/iOSProject/pyunrihae/pyunrihae/AllergyViewController.swift b/iOSProject/pyunrihae/pyunrihae/AllergyViewController.swift index e2dd0038..01b2b775 100644 --- a/iOSProject/pyunrihae/pyunrihae/AllergyViewController.swift +++ b/iOSProject/pyunrihae/pyunrihae/AllergyViewController.swift @@ -20,12 +20,12 @@ class AllergyViewController: UIViewController { super.didReceiveMemoryWarning() } @IBAction func tabBackBtn(_ sender: UIButton) { - let writingReviewViewController = self.navigationController?.viewControllers[1] as! WritingReviewViewController + let writingReviewViewController = self.navigationController?.viewControllers[2] as! WritingReviewViewController self.navigationController?.popToViewController(writingReviewViewController, animated: true) } @IBAction func tabCompleteBtn(_ sender: UIButton) { NotificationCenter.default.post(name: NSNotification.Name("selectAllergy"), object: self, userInfo: ["allergy" : selectedAllergy]) - let writingReviewViewController = self.navigationController?.viewControllers[1] as! WritingReviewViewController + let writingReviewViewController = self.navigationController?.viewControllers[2] as! WritingReviewViewController self.navigationController?.popToViewController(writingReviewViewController, animated: true) } } diff --git a/iOSProject/pyunrihae/pyunrihae/AppDelegate.swift b/iOSProject/pyunrihae/pyunrihae/AppDelegate.swift index 0fd33207..7f4f05bb 100644 --- a/iOSProject/pyunrihae/pyunrihae/AppDelegate.swift +++ b/iOSProject/pyunrihae/pyunrihae/AppDelegate.swift @@ -36,9 +36,6 @@ class AppDelegate: UIResponder, UIApplicationDelegate,GIDSignInDelegate{ } } } - - // 오프라인 일 때 기기에 저장 - Database.database().isPersistenceEnabled = true return true } func applicationWillResignActive(_ application: UIApplication) { diff --git a/iOSProject/pyunrihae/pyunrihae/Base.lproj/Main.storyboard b/iOSProject/pyunrihae/pyunrihae/Base.lproj/Main.storyboard index c3f84c48..ac860010 100644 --- a/iOSProject/pyunrihae/pyunrihae/Base.lproj/Main.storyboard +++ b/iOSProject/pyunrihae/pyunrihae/Base.lproj/Main.storyboard @@ -1,5 +1,5 @@ - + @@ -25,48 +25,24 @@ - - - - - - - - - - - - - - - - - - - - + + + + + - - - - - - - - - - - - - - - - - + @@ -82,16 +58,7 @@ - - - - - - - - - @@ -121,16 +88,15 @@ - - + - + @@ -418,88 +384,75 @@ - - + + - - + - - - - - - - - - - - - - - - - - - - - + + + + + + + + - + - - - - - - - - - + - + + + + + - @@ -514,7 +467,7 @@ - + @@ -692,7 +645,7 @@ - + @@ -762,9 +715,9 @@ - + - + @@ -1306,25 +1259,26 @@ - - - - - @@ -1333,13 +1287,13 @@ - + - + @@ -1408,7 +1362,7 @@ - + @@ -1725,7 +1679,7 @@ - + @@ -1740,7 +1694,7 @@ - + @@ -1757,7 +1711,7 @@ - + @@ -1845,7 +1799,7 @@ - + @@ -3028,22 +2982,22 @@ - + - + - + - + - + - + @@ -3063,7 +3017,6 @@ - @@ -3086,5 +3039,5 @@ - + diff --git a/iOSProject/pyunrihae/pyunrihae/Image.swift b/iOSProject/pyunrihae/pyunrihae/Image.swift index ba02d9e7..52242456 100644 --- a/iOSProject/pyunrihae/pyunrihae/Image.swift +++ b/iOSProject/pyunrihae/pyunrihae/Image.swift @@ -13,41 +13,34 @@ class Image { image.layer.cornerRadius = image.layer.frame.height/2 image.clipsToBounds = true } - static func drawStar(numberOfPlaces: Double, grade_avg: Double, gradeLabel: UILabel, starView: UIView, needSpace: Bool) { + static func drawStar(numberOfPlaces: Double, grade_avg: Double, gradeLabel: UILabel, starView: UIView) { for sub in starView.subviews { sub.removeFromSuperview() } let multiplier = pow(10.0, numberOfPlaces) let grade = round(Double(grade_avg) * multiplier) / multiplier gradeLabel.text = String(grade) - var space = 0 if grade - Double(Int(grade)) >= 0.5 { let starImage = UIImage(named: "stars.png") let cgImage = starImage?.cgImage let croppedCGImage: CGImage = cgImage!.cropping(to: CGRect(x: (starImage?.size.width)! * 4 / 5, y: 10, width: (starImage?.size.width)!, height: starImage!.size.height))! let uiImage = UIImage(cgImage: croppedCGImage) let imageView = UIImageView(image: uiImage) - if needSpace { - space = (4 - Int(grade)) * 15 - } - imageView.frame = CGRect(x: Int(grade) * 18 - 3 + space, y: 0, width: 18, height: 15) + imageView.frame = CGRect(x: Int(grade) * 18 - 3, y: 0, width: 17, height: 15) starView.addSubview(imageView) for i in (5 - Int(grade)..<5) { let emptyStarImage = UIImage(named: "empty_star.png") let imageView = UIImageView(image: emptyStarImage) imageView.contentMode = .scaleAspectFit - imageView.frame = CGRect(x: i * 18 - 3 + space, y: 0, width: 18, height: 15) + imageView.frame = CGRect(x: i * 18 - 3, y: 0, width: 17, height: 15) starView.addSubview(imageView) } } else{ - if needSpace{ - space = (5 - Int(grade)) * 15 - } for i in Int(grade)..<5 { let emptyStarImage = UIImage(named: "empty_star.png") let imageView = UIImageView(image: emptyStarImage) imageView.contentMode = .scaleAspectFit - imageView.frame = CGRect(x: i * 18 - 3 + space, y: 0, width: 18, height: 15) + imageView.frame = CGRect(x: i * 18 - 3, y: 0, width: 17, height: 15) starView.addSubview(imageView) } } @@ -57,7 +50,7 @@ class Image { let croppedCGImage: CGImage = cgImage!.cropping(to: CGRect(x: 0, y: 10, width: (starImage?.size.width)! / 5, height: starImage!.size.height))! let uiImage = UIImage(cgImage: croppedCGImage) let imageView = UIImageView(image: uiImage) - imageView.frame = CGRect(x: i * 18 + space, y: 0, width: 18, height: 15) + imageView.frame = CGRect(x: i * 18, y: 0, width: 17, height: 15) starView.addSubview(imageView) } } diff --git a/iOSProject/pyunrihae/pyunrihae/MainViewController.swift b/iOSProject/pyunrihae/pyunrihae/MainViewController.swift index 86b7920f..5747564b 100644 --- a/iOSProject/pyunrihae/pyunrihae/MainViewController.swift +++ b/iOSProject/pyunrihae/pyunrihae/MainViewController.swift @@ -9,7 +9,6 @@ import UIKit class MainViewController: UIViewController { @IBOutlet weak var reviewScrollView: UIScrollView! @IBOutlet weak var categoryScrollView: UIScrollView! - @IBOutlet weak var indicatorView: UIActivityIndicatorView! @IBOutlet weak var productScrollView: UIScrollView! let appdelegate = UIApplication.shared.delegate as! AppDelegate var productList : [Product] = [] @@ -51,6 +50,7 @@ class MainViewController: UIViewController { DataManager.getTop3Product() { (products) in self.productList = products DispatchQueue.main.async { + NotificationCenter.default.post(name: NSNotification.Name("doneLoading"), object: self) // self.collectionView.reloadData() } } @@ -62,14 +62,8 @@ class MainViewController: UIViewController { func showDetailProduct(_ notification: Notification) { if notification.userInfo?["validator"] as! Int == 0{ let storyboard = UIStoryboard(name: "Main", bundle: nil) - let vc = storyboard.instantiateViewController(withIdentifier: "mainNavigationController") as! UINavigationController - let transition = CATransition() - transition.duration = 0.4 - transition.type = kCATransitionPush - transition.subtype = kCATransitionFromRight - transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) - self.view.window!.layer.add(transition, forKey: kCATransition) - self.present(vc, animated: false, completion: nil) + let vc = storyboard.instantiateViewController(withIdentifier: "ProductDetailViewController") as! ProductDetailViewController + self.navigationController?.pushViewController(vc, animated: true) NotificationCenter.default.post(name: NSNotification.Name("showReviewProduct"), object: self, userInfo: ["product" : review]) } } @@ -365,14 +359,8 @@ class MainViewController: UIViewController { let product = productList[(sender.view?.tag)!] NotificationCenter.default.post(name: NSNotification.Name("showProduct"), object: self, userInfo: ["product" : product]) let storyboard = UIStoryboard(name: "Main", bundle: nil) - let vc = storyboard.instantiateViewController(withIdentifier: "mainNavigationController") as! UINavigationController - let transition = CATransition() - transition.duration = 0.4 - transition.type = kCATransitionPush - transition.subtype = kCATransitionFromRight - transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) - self.view.window!.layer.add(transition, forKey: kCATransition) - self.present(vc, animated: false, completion: nil) + let vc = storyboard.instantiateViewController(withIdentifier: "ProductDetailViewController") as! ProductDetailViewController + self.navigationController?.pushViewController(vc, animated: true) } } } diff --git a/iOSProject/pyunrihae/pyunrihae/ProductDetailViewController.swift b/iOSProject/pyunrihae/pyunrihae/ProductDetailViewController.swift index c1da6651..a8c5fec3 100644 --- a/iOSProject/pyunrihae/pyunrihae/ProductDetailViewController.swift +++ b/iOSProject/pyunrihae/pyunrihae/ProductDetailViewController.swift @@ -77,13 +77,7 @@ class ProductDetailViewController: UIViewController { } } func close() { - let transition = CATransition() - transition.duration = 0.4 - transition.type = kCATransitionPush - transition.subtype = kCATransitionFromLeft - transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) - self.view.window!.layer.add(transition, forKey: kCATransition) - self.dismiss(animated: false, completion: nil) + self.navigationController?.popToRootViewController(animated: true) NotificationCenter.default.post(name: NSNotification.Name("reloadReview"), object: self) } @IBAction func closeNavViewBtn(_ sender: UIButton) { diff --git a/iOSProject/pyunrihae/pyunrihae/ReviewViewController.swift b/iOSProject/pyunrihae/pyunrihae/ReviewViewController.swift index ad85259d..dc03b3e1 100644 --- a/iOSProject/pyunrihae/pyunrihae/ReviewViewController.swift +++ b/iOSProject/pyunrihae/pyunrihae/ReviewViewController.swift @@ -55,14 +55,8 @@ class ReviewViewController: UIViewController { func showDetailProduct(_ notification: Notification) { if notification.userInfo?["validator"] as! Int == 1{ let storyboard = UIStoryboard(name: "Main", bundle: nil) - let vc = storyboard.instantiateViewController(withIdentifier: "mainNavigationController") as! UINavigationController - let transition = CATransition() - transition.duration = 0.4 - transition.type = kCATransitionPush - transition.subtype = kCATransitionFromRight - transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) - self.view.window!.layer.add(transition, forKey: kCATransition) - self.present(vc, animated: false, completion: nil) + let vc = storyboard.instantiateViewController(withIdentifier: "ProductDetailViewController") as! ProductDetailViewController + self.navigationController?.pushViewController(vc, animated: true) NotificationCenter.default.post(name: NSNotification.Name("showReviewProduct"), object: self, userInfo: ["product" : review]) } } diff --git a/iOSProject/pyunrihae/pyunrihae/SearchViewController.swift b/iOSProject/pyunrihae/pyunrihae/SearchViewController.swift index 8364050d..480a5de5 100644 --- a/iOSProject/pyunrihae/pyunrihae/SearchViewController.swift +++ b/iOSProject/pyunrihae/pyunrihae/SearchViewController.swift @@ -34,7 +34,7 @@ class SearchViewController: YNSearchViewController,YNSearchDelegate { // Dispose of any resources that can be recreated. } @IBAction func onBackBtnPressed(_ sender: Any) { - self.dismiss(animated: true, completion: nil) + self.navigationController?.popToRootViewController(animated: true) } func ynSearchListViewDidScroll() { self.ynSearchTextfieldView.ynSearchTextField.endEditing(true) @@ -85,14 +85,8 @@ class SearchViewController: YNSearchViewController,YNSearchDelegate { NotificationCenter.default.post(name: NSNotification.Name("complete"), object: self) } let storyboard = UIStoryboard(name: "Main", bundle: nil) - let vc = storyboard.instantiateViewController(withIdentifier: "mainNavigationController") as! UINavigationController - let transition = CATransition() - transition.duration = 0.4 - transition.type = kCATransitionPush - transition.subtype = kCATransitionFromRight - transition.timingFunction = CAMediaTimingFunction(name: kCAMediaTimingFunctionEaseInEaseOut) - self.view.window!.layer.add(transition, forKey: kCATransition) - self.present(vc, animated: false, completion: nil) + let vc = storyboard.instantiateViewController(withIdentifier: "ProductDetailViewController") as! ProductDetailViewController + self.navigationController?.pushViewController(vc, animated: true) } func pushRankingController(text : String) { NotificationCenter.default.post(name: NSNotification.Name("showRanking"), object: self) @@ -109,6 +103,6 @@ class SearchViewController: YNSearchViewController,YNSearchDelegate { default : categoryIndex = 0 } NotificationCenter.default.post(name: NSNotification.Name("selectCategory"), object: self, userInfo: ["category" : categoryIndex]) - self.dismiss(animated: true, completion: nil) + self.navigationController?.popToRootViewController(animated: true) } } diff --git a/iOSProject/pyunrihae/pyunrihae/Segue.swift b/iOSProject/pyunrihae/pyunrihae/Segue.swift deleted file mode 100644 index cfe3ba5c..00000000 --- a/iOSProject/pyunrihae/pyunrihae/Segue.swift +++ /dev/null @@ -1,30 +0,0 @@ -// -// Segue.swift -// pyunrihae -// -// Created by woowabrothers on 2017. 8. 28.. -// Copyright © 2017년 busride. All rights reserved. -// - -import Foundation -import UIKit -class Segue: UIStoryboardSegue -{ - override func perform() - { - let src = self.source.parent - let dst = self.destination - src?.view.superview?.insertSubview(dst.view, aboveSubview: (src?.view)!) - dst.view.transform = CGAffineTransform(translationX: (src?.view.frame.size.width)!, y: 0) - UIView.animate(withDuration: 0.25, - delay: 0.0, - options: UIViewAnimationOptions.curveEaseInOut, - animations: { - dst.view.transform = CGAffineTransform(translationX: 0, y: 0) - }, - completion: { finished in - src?.present(dst, animated: false, completion: nil) - } - ) - } -} diff --git a/iOSProject/pyunrihae/pyunrihae/TabBarViewController.swift b/iOSProject/pyunrihae/pyunrihae/TabBarViewController.swift index c37ccd01..06c372bb 100644 --- a/iOSProject/pyunrihae/pyunrihae/TabBarViewController.swift +++ b/iOSProject/pyunrihae/pyunrihae/TabBarViewController.swift @@ -13,7 +13,6 @@ class TabBarViewController: UIViewController,NVActivityIndicatorViewable { @IBOutlet weak var waitingImage: UIImageView! @IBOutlet weak var pyunrihaeImage: UIImageView! // 대기화면 @IBOutlet var searchBtn : UIButton! - @IBOutlet var titleLabel : UILabel! @IBOutlet var brandBtns : [UIButton]! // 브랜드 메뉴 버튼 4개 @IBOutlet weak var contentView: UIView! //탭에 따라 바뀔 뷰 부분 @IBOutlet weak var brandContentView: UIView! // 브랜드 버튼 뷰 @@ -33,10 +32,16 @@ class TabBarViewController: UIViewController,NVActivityIndicatorViewable { let appdelegate = UIApplication.shared.delegate as! AppDelegate override func viewDidLoad() { super.viewDidLoad() + UINavigationBar.appearance().backgroundColor = UIColor.white + UINavigationBar.appearance().tintColor = UIColor.black + UINavigationBar.appearance().shadowImage = UIImage() + UINavigationBar.appearance().setBackgroundImage(UIImage(), for: .default) brandContentView.isHidden = true tabContentView.isHidden = true contentView.isHidden = true // 화면 받아오기 전까지 화면 터치 안됨 + self.navigationController?.setNavigationBarHidden(true, animated: false) saveProductListToGlobal() + animateView() NVActivityIndicatorView.DEFAULT_BLOCKER_BACKGROUND_COLOR = UIColor(red: 0, green: 0, blue: 0, alpha: 0) NVActivityIndicatorView.DEFAULT_TYPE = .pacman NVActivityIndicatorView.DEFAULT_BLOCKER_MESSAGE = "편리해 정보를 받아오는 중입니다..." @@ -47,7 +52,6 @@ class TabBarViewController: UIViewController,NVActivityIndicatorViewable { //카테고리 선택 탭 화면간 공유 NotificationCenter.default.addObserver(self, selector: #selector(doneLoading), name: NSNotification.Name("doneLoading"), object: nil) //데이터 받아오기 완료 - animateView() let storyboard = UIStoryboard(name: "Main", bundle: nil) mainViewController = storyboard.instantiateViewController(withIdentifier: "MainViewController") as! MainViewController mainViewController.selectedBrandIndexFromTab = selectedBrandIndex @@ -91,7 +95,7 @@ class TabBarViewController: UIViewController,NVActivityIndicatorViewable { vc.view.frame = contentView.bounds contentView.addSubview(vc.view) vc.didMove(toParentViewController: self) - titleLabel.text = titleName[selectedTabIndex] + self.navigationItem.title = titleName[selectedTabIndex] if selectedTabIndex == 3 { brandContentView.isHidden = true vc.view.frame.origin.y -= 40 @@ -134,19 +138,14 @@ class TabBarViewController: UIViewController,NVActivityIndicatorViewable { brandContentView.isHidden = false tabContentView.isHidden = false contentView.isHidden = false + self.navigationController?.setNavigationBarHidden(false, animated: false) + self.watingView.isHidden = true + self.waitingImage.isHidden = true self.stopAnimating() - UIView.animate(withDuration: 0.5, delay: 0, animations: { - self.waitingImage.alpha -= 1 - self.watingView.alpha -= 0.35 - }, completion: { (complete:Bool) in - self.watingView.isHidden = true - self.waitingImage.isHidden = true - }) } func saveProductListToGlobal(){ // 전체 상품 데이터 받아오기 DataManager.getProductAllInRank(){ (products) in self.appdelegate.productList = products.sorted(by: {$0.grade_avg > $1.grade_avg}) - NotificationCenter.default.post(name: NSNotification.Name("doneLoading"), object: self) } } } diff --git a/iOSProject/pyunrihae/pyunrihae/WritingReviewViewController.swift b/iOSProject/pyunrihae/pyunrihae/WritingReviewViewController.swift index d0e0685d..8f7bad4f 100644 --- a/iOSProject/pyunrihae/pyunrihae/WritingReviewViewController.swift +++ b/iOSProject/pyunrihae/pyunrihae/WritingReviewViewController.swift @@ -74,7 +74,8 @@ class WritingReviewViewController: UIViewController, FusumaDelegate{ super.didReceiveMemoryWarning() } @IBAction func tabBackBtn(_ sender: UIButton) { - self.navigationController?.popToRootViewController(animated: true) + let productDetailViewController = self.navigationController?.viewControllers[1] as! ProductDetailViewController + self.navigationController?.popToViewController(productDetailViewController, animated: true) } @IBAction func tabCompleteBtn(_ sender: UIButton) { var user_image = ""