diff --git a/iOSProject/pyunrihae/pyunrihae/MainViewController.swift b/iOSProject/pyunrihae/pyunrihae/MainViewController.swift index 07072b1f..3d209794 100644 --- a/iOSProject/pyunrihae/pyunrihae/MainViewController.swift +++ b/iOSProject/pyunrihae/pyunrihae/MainViewController.swift @@ -141,7 +141,7 @@ class MainViewController: UIViewController { self.productList = [] for product in self.appdelegate.productList { if product.category == categoryBtns[selectedCategoryIndex].titleLabel?.text!{ - self.productList.append(product) + self.productList.append(product) } } DispatchQueue.main.async { @@ -177,6 +177,7 @@ class MainViewController: UIViewController { } // 리뷰의 스크롤 이미지를 가져오는 함수 func setReviewScrollImages(){ + var brand = "" switch selectedBrandIndexFromTab { case 0 : brand = "전체" @@ -185,7 +186,6 @@ class MainViewController: UIViewController { case 3 : brand = "7-eleven" default : break } -// indicatorView.startAnimating() DataManager.getTop3ReviewByBrand(brand: brand) { (reviews) in self.reviewList = reviews if self.reviewScrollView != nil { @@ -256,9 +256,15 @@ class MainViewController: UIViewController { } } func setProductScrollView(){ + + // 기존에 붙어있던 subview를 제거 for subview in self.productScrollView.subviews { subview.removeFromSuperview() } + + // 스크롤을 맨 앞으로 다시 가져온다. + self.productScrollView.contentOffset.x = 0 + if self.productScrollView != nil { let imageViewWidth = self.productScrollView.frame.size.width; let imageViewHeight = self.productScrollView.frame.size.height; diff --git a/iOSProject/pyunrihae/pyunrihae/Pyunrihae.swift b/iOSProject/pyunrihae/pyunrihae/Pyunrihae.swift index 730d5688..1c909544 100644 --- a/iOSProject/pyunrihae/pyunrihae/Pyunrihae.swift +++ b/iOSProject/pyunrihae/pyunrihae/Pyunrihae.swift @@ -6,12 +6,20 @@ // Copyright © 2017년 busride. All rights reserved. // +/* + * 편리해 앱에서 + * 반복적으로 사용되는 함수들을 모아놓은 model입니다. + */ + import Foundation class Pyunrihae { + /* + * 비회원일 때 로그인 필요 기능에 팝업 띄우기 + */ static func showLoginOptionPopup(_ controller : UIViewController){ let alertController = UIAlertController(title: "알림", message: "로그인 뒤 이용가능합니다.", preferredStyle: UIAlertControllerStyle.alert) let DestructiveAction = UIAlertAction(title: "취소", style: UIAlertActionStyle.destructive) { (result : UIAlertAction) -> Void in