Skip to content

Commit

Permalink
170828 - 세븐일레븐 등 상품 없을때 기본이미지 처리 #207
Browse files Browse the repository at this point in the history
  • Loading branch information
JuneBuug committed Aug 28, 2017
1 parent 2f59386 commit d4aa3c3
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions iOSProject/pyunrihae/pyunrihae.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
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 */; };
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 */; };
98B394881F4E5EDA0071BB8B /* MainProduct.xib in Resources */ = {isa = PBXBuildFile; fileRef = 98B394871F4E5EDA0071BB8B /* MainProduct.xib */; };
98B3948A1F4E63230071BB8B /* MainProduct.swift in Sources */ = {isa = PBXBuildFile; fileRef = 98B394891F4E63230071BB8B /* MainProduct.swift */; };
Expand Down Expand Up @@ -186,6 +187,7 @@
989FA79B1F511E59001D1E42 /* ReviewPopupView.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = ReviewPopupView.xib; sourceTree = "<group>"; };
989FA79F1F52BEC8001D1E42 /* Popup.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = Popup.swift; sourceTree = "<group>"; };
989FA7A31F52E2BA001D1E42 /* ic_check.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ic_check.png; sourceTree = "<group>"; };
98B2885F1F53EF43007673FF /* ic_default_product.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = ic_default_product.png; sourceTree = "<group>"; };
98B394851F4D59190071BB8B /* ProductAllergyViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ProductAllergyViewController.swift; sourceTree = "<group>"; };
98B394871F4E5EDA0071BB8B /* MainProduct.xib */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.xib; path = MainProduct.xib; sourceTree = "<group>"; };
98B394891F4E63230071BB8B /* MainProduct.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MainProduct.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -343,6 +345,7 @@
98D5691F1F4BE6EC002693E9 /* useful.png */,
98D5691D1F4BE6DA002693E9 /* bad.png */,
98CBA0D51F4AE17B003D0370 /* ic_common.png */,
98B2885F1F53EF43007673FF /* ic_default_product.png */,
98CBA0B51F458AFC003D0370 /* ic_user.png */,
98CBA0C71F468196003D0370 /* ic_star_filled.png */,
98CBA0DB1F4B0BA2003D0370 /* ic_photo_edit.png */,
Expand Down Expand Up @@ -715,6 +718,7 @@
98CBA0CE1F468536003D0370 /* ic_like.png in Resources */,
98F865871F43FB1A00C2F333 /* star5.png in Resources */,
98D9F2E41F418DF3009D0E10 /* YNSearch.xcassets in Resources */,
98B288601F53EF43007673FF /* ic_default_product.png in Resources */,
984395861F32F29A0016B67D /* GoogleService-Info.plist in Resources */,
98F865AB1F442F8B00C2F333 /* ic_password.png in Resources */,
98F865A71F442EE100C2F333 /* ic_close.png in Resources */,
Expand Down
16 changes: 14 additions & 2 deletions iOSProject/pyunrihae/pyunrihae/MainViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,12 @@ class MainViewController: UIViewController {
var cnt = 0
let scrollViewNum = 10
self.productScrollView.contentSize = CGSize(width: imageViewWidth / 3.0 * CGFloat(scrollViewNum), height: imageViewHeight);
if productList.count < 10 {
for _ in 1...(10-productList.count){
let product = Product.init()
productList.append(product)
}
}
for product in productList {
if cnt >= scrollViewNum {
break;
Expand All @@ -272,8 +278,14 @@ class MainViewController: UIViewController {
productView.frame = CGRect(x: xPosition, y: 0, width: imageViewWidth / 3.0, height: imageViewWidth / 3.0)
productView.center.y = imageViewHeight / 2.0
// productView들어감
productView.productImageview.contentMode = .scaleAspectFit
productView.productImageview.af_setImage(withURL: url!)
if product.name != "" {
productView.productImageview.contentMode = .scaleAspectFit
productView.productImageview.af_setImage(withURL: url!)
}else{
productView.productImageview.contentMode = .scaleAspectFit
productView.productImageview.image = #imageLiteral(resourceName: "ic_default_product.png")
}

productView.rankLabel.text = (cnt + 1).description
switch (product.brand) {
case "GS25": productView.logoImageView.image = #imageLiteral(resourceName: "logo_gs25.png")
Expand Down
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit d4aa3c3

Please sign in to comment.