forked from Health-Food-Me/Health-Food-Me-iOS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'develop' of https://github.com/Health-Food-Me/Health-Fo…
…od-Me-iOS into feature/Health-Food-Me#43
- Loading branch information
Showing
43 changed files
with
557 additions
and
89 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
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
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
File renamed without changes.
Binary file added
BIN
+1.21 KB
...ealthFoodMe/Global/Resources/Assets.xcassets/Map/icn_diet.imageset/icn_diet.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.28 KB
...thFoodMe/Global/Resources/Assets.xcassets/Map/icn_diet.imageset/icn_diet@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.46 KB
...thFoodMe/Global/Resources/Assets.xcassets/Map/icn_diet.imageset/icn_diet@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
...ealthFoodMe/Global/Resources/Assets.xcassets/Map/icn_diet_selected.imageset/Contents.json
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,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "icn_diet_selected.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "icn_diet_selected@2x.png", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "icn_diet_selected@3x.png", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+1.71 KB
.../Resources/Assets.xcassets/Map/icn_diet_selected.imageset/icn_diet_selected.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.26 KB
...sources/Assets.xcassets/Map/icn_diet_selected.imageset/icn_diet_selected@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+5.04 KB
...sources/Assets.xcassets/Map/icn_diet_selected.imageset/icn_diet_selected@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.
Binary file added
BIN
+1.05 KB
...hFoodMe/Global/Resources/Assets.xcassets/Map/icn_normal.imageset/icn_normal.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+1.99 KB
...odMe/Global/Resources/Assets.xcassets/Map/icn_normal.imageset/icn_normal@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+3.08 KB
...odMe/Global/Resources/Assets.xcassets/Map/icn_normal.imageset/icn_normal@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions
23
...althFoodMe/Global/Resources/Assets.xcassets/Map/icn_normal_seleted.imageset/Contents.json
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,23 @@ | ||
{ | ||
"images" : [ | ||
{ | ||
"filename" : "icn_normal_seleted.png", | ||
"idiom" : "universal", | ||
"scale" : "1x" | ||
}, | ||
{ | ||
"filename" : "icn_normal_seleted@2x.png", | ||
"idiom" : "universal", | ||
"scale" : "2x" | ||
}, | ||
{ | ||
"filename" : "icn_normal_seleted@3x.png", | ||
"idiom" : "universal", | ||
"scale" : "3x" | ||
} | ||
], | ||
"info" : { | ||
"author" : "xcode", | ||
"version" : 1 | ||
} | ||
} |
Binary file added
BIN
+1.47 KB
...esources/Assets.xcassets/Map/icn_normal_seleted.imageset/icn_normal_seleted.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+2.96 KB
...urces/Assets.xcassets/Map/icn_normal_seleted.imageset/icn_normal_seleted@2x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+4.4 KB
...urces/Assets.xcassets/Map/icn_normal_seleted.imageset/icn_normal_seleted@3x.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed
BIN
-505 Bytes
...thFoodMe/Global/Resources/Assets.xcassets/Search/icn_diet.imageset/icn_diet.png
Binary file not shown.
Binary file removed
BIN
-931 Bytes
...oodMe/Global/Resources/Assets.xcassets/Search/icn_diet.imageset/icn_diet@2x.png
Binary file not shown.
Binary file removed
BIN
-1.27 KB
...oodMe/Global/Resources/Assets.xcassets/Search/icn_diet.imageset/icn_diet@3x.png
Binary file not shown.
Binary file removed
BIN
-430 Bytes
...odMe/Global/Resources/Assets.xcassets/Search/icn_normal.imageset/icn_normal.png
Binary file not shown.
Binary file removed
BIN
-779 Bytes
...e/Global/Resources/Assets.xcassets/Search/icn_normal.imageset/icn_normal@2x.png
Binary file not shown.
Binary file removed
BIN
-1.11 KB
...e/Global/Resources/Assets.xcassets/Search/icn_normal.imageset/icn_normal@3x.png
Binary file not shown.
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
107 changes: 107 additions & 0 deletions
107
HealthFoodMe/HealthFoodMe/Presentation/Common/UI Components/CustomSegementControl.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,107 @@ | ||
// | ||
// CustomSegementControl.swift | ||
// HealthFoodMe | ||
// | ||
// Created by 송지훈 on 2022/07/13. | ||
// | ||
|
||
import UIKit | ||
|
||
import SnapKit | ||
|
||
final class CustomSegmentControl: UIView { | ||
|
||
internal var areaClickEvent: ((Int) -> Void)? | ||
internal var containerColor: UIColor = .init(red: 242/255, green: 242/255, blue: 242/255, alpha: 1) | ||
internal var selectColor: UIColor = .white | ||
internal var titleList: [String] = ["첫번째","두번째"] | ||
internal var width: CGFloat = 226 | ||
private lazy var selectedView = UIView() | ||
private lazy var containerStackView = UIStackView() | ||
|
||
override init(frame: CGRect) { | ||
super.init(frame: frame) | ||
setUI() | ||
setStackView() | ||
} | ||
|
||
required init?(coder aDecoder: NSCoder) { | ||
super.init(coder: aDecoder) | ||
setUI() | ||
setStackView() | ||
} | ||
} | ||
|
||
extension CustomSegmentControl { | ||
private func setStackView() { | ||
containerStackView.axis = .horizontal | ||
containerStackView.spacing = 0 | ||
containerStackView.distribution = .fillEqually | ||
for (index, _) in titleList.enumerated() { | ||
let buttonContainerView = UIView() | ||
let button = UIButton() | ||
let titleLabel = UILabel() | ||
|
||
titleLabel.textAlignment = .center | ||
titleLabel.text = titleList[index] | ||
titleLabel.textColor = UIColor.init(red: 34/255, | ||
green: 34/255, | ||
blue: 34/255, | ||
alpha: 1) | ||
titleLabel.font = UIFont.systemFont(ofSize: 12) | ||
buttonContainerView.addSubview(button) | ||
buttonContainerView.addSubview(titleLabel) | ||
|
||
button.snp.makeConstraints { make in | ||
make.edges.equalToSuperview() | ||
} | ||
|
||
titleLabel.snp.makeConstraints { make in | ||
make.centerX.centerY.equalToSuperview() | ||
make.leading.trailing.equalToSuperview() | ||
} | ||
|
||
button.backgroundColor = .clear | ||
button.tag = index | ||
button.addTarget(self, action: #selector(buttonClicked(_:)), for: .touchUpInside) | ||
containerStackView.addArrangedSubview(buttonContainerView) | ||
} | ||
} | ||
|
||
private func setUI() { | ||
backgroundColor = containerColor | ||
layer.cornerRadius = 16 | ||
selectedView.backgroundColor = selectColor | ||
selectedView.layer.cornerRadius = 16 | ||
containerStackView.backgroundColor = .clear | ||
|
||
addSubview(selectedView) | ||
addSubview(containerStackView) | ||
|
||
selectedView.snp.makeConstraints { make in | ||
make.top.equalToSuperview().offset(4) | ||
make.leading.equalToSuperview().offset(4) | ||
make.bottom.equalToSuperview().offset(-4) | ||
make.width.equalTo( (width - 8) / CGFloat(titleList.count)) | ||
} | ||
containerStackView.snp.makeConstraints { make in | ||
make.edges.equalToSuperview() | ||
} | ||
} | ||
|
||
@objc | ||
func buttonClicked(_ button: UIButton) { | ||
let generator = UIImpactFeedbackGenerator(style: .medium) | ||
generator.impactOccurred() | ||
let buttonTag = button.tag | ||
areaClickEvent?(buttonTag) | ||
let buttonWidth = (width - 8) / CGFloat(titleList.count) | ||
selectedView.snp.updateConstraints { make in | ||
make.leading.equalToSuperview().offset(CGFloat(buttonTag) * buttonWidth + 4) | ||
} | ||
|
||
UIView.animate(withDuration: 0.3) { | ||
self.layoutIfNeeded() | ||
} | ||
} | ||
} |
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
Oops, something went wrong.