forked from codesquad-members-2021/sidedish
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#5 Feat: Image HashValue & configure sideCell
- Loading branch information
Showing
9 changed files
with
149 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...shApp/sidedishApp.xcodeproj/project.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> | ||
<plist version="1.0"> | ||
<dict> | ||
<key>PreviewsEnabled</key> | ||
<false/> | ||
</dict> | ||
</plist> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// | ||
// Extension.swift | ||
// sidedishApp | ||
// | ||
// Created by 김지선 on 2021/04/28. | ||
// | ||
|
||
import Foundation | ||
import UIKit | ||
|
||
extension UIColor { | ||
class func hexStringToUIColor(hex: String) -> UIColor { | ||
let hexString = hex.trimmingCharacters(in: ["#"]) | ||
var rgbValue:UInt32 = 0 | ||
Scanner(string: hexString).scanHexInt32(&rgbValue) | ||
return UIColor( | ||
red: CGFloat((rgbValue & 0xFF0000) >> 16) / 255.0, | ||
green: CGFloat((rgbValue & 0x00FF00) >> 8) / 255.0, | ||
blue: CGFloat(rgbValue & 0x0000FF) / 255.0, | ||
alpha: CGFloat(1.0) | ||
) | ||
} | ||
} | ||
|
||
extension String { | ||
func strikeThrough() -> NSAttributedString { | ||
let attributeString: NSMutableAttributedString = NSMutableAttributedString(string: self) | ||
attributeString.addAttribute(NSAttributedString.Key.strikethroughStyle, value: NSUnderlineStyle.single.rawValue, range: NSMakeRange(0, attributeString.length)) | ||
return attributeString | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
ios/sidedishApp/sidedishApp/Presentation/UI/Views/PriceStackView.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
// | ||
// PriceStackView.swift | ||
// sidedishApp | ||
// | ||
// Created by 김지선 on 2021/04/28. | ||
// | ||
|
||
import UIKit | ||
|
||
class PriceStackView: UIStackView { | ||
let normalPriceLabel = UILabel() | ||
let salePriceLabel = UILabel() | ||
|
||
func configureStackView(normalPrice: Int, salePrice: Int) { | ||
if salePrice == -1 { | ||
configureNotSale() | ||
normalPriceLabel.text = "\(normalPrice)원" | ||
addArrangedSubview(normalPriceLabel) | ||
} else { | ||
configureSale() | ||
normalPriceLabel.text = "\(normalPrice)원" | ||
normalPriceLabel.attributedText = normalPriceLabel.text?.strikeThrough() | ||
salePriceLabel.text = "\(salePrice)" | ||
|
||
addArrangedSubview(salePriceLabel) | ||
addArrangedSubview(normalPriceLabel) | ||
} | ||
|
||
self.axis = .horizontal | ||
self.spacing = 8 | ||
} | ||
|
||
func configureNotSale() { | ||
normalPriceLabel.font = UIFont.boldSystemFont(ofSize: 15) | ||
normalPriceLabel.textColor = .black | ||
|
||
} | ||
|
||
func configureSale() { | ||
salePriceLabel.font = UIFont.boldSystemFont(ofSize: 15) | ||
normalPriceLabel.font = UIFont.systemFont(ofSize: 14) | ||
normalPriceLabel.textColor = .systemGray2 | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters