Skip to content

Commit

Permalink
170829 - 메인 화면에서 카테고리 변경 시 상품 스크롤뷰 맨 앞으로 가도록 #207
Browse files Browse the repository at this point in the history
  • Loading branch information
JuneBuug committed Aug 29, 2017
1 parent 2bbef4c commit 6dc936e
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 2 deletions.
10 changes: 8 additions & 2 deletions iOSProject/pyunrihae/pyunrihae/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -177,6 +177,7 @@ class MainViewController: UIViewController {
}
// 리뷰의 스크롤 이미지를 가져오는 함수
func setReviewScrollImages(){

var brand = ""
switch selectedBrandIndexFromTab {
case 0 : brand = "전체"
Expand All @@ -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 {
Expand Down Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions iOSProject/pyunrihae/pyunrihae/Pyunrihae.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 6dc936e

Please sign in to comment.