-
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.
Merge pull request #152 from OMZigak/feat/146-schedule-detail
[feat] 약속 상세 화면 중간 PR 및 NavigationBar 두개 겹치는 문제 해결, mainTabBar 색상 변경
- Loading branch information
Showing
11 changed files
with
335 additions
and
29 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
// | ||
// PromiseInfoViewController.swift | ||
// KkuMulKum | ||
// | ||
// Created by YOUJIM on 7/9/24. | ||
// | ||
|
||
import UIKit | ||
|
||
class PromiseInfoViewController: BaseViewController { | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
|
||
// Do any additional setup after loading the view. | ||
} | ||
|
||
|
||
/* | ||
// MARK: - Navigation | ||
|
||
// In a storyboard-based application, you will often want to do a little preparation before navigation | ||
override func prepare(for segue: UIStoryboardSegue, sender: Any?) { | ||
// Get the new view controller using segue.destination. | ||
// Pass the selected object to the new view controller. | ||
} | ||
*/ | ||
|
||
} |
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,81 @@ | ||
// | ||
// PromiseSegmentedControl.swift | ||
// KkuMulKum | ||
// | ||
// Created by YOUJIM on 7/9/24. | ||
// | ||
|
||
import UIKit | ||
|
||
import SnapKit | ||
|
||
class PromiseSegmentedControl: UISegmentedControl { | ||
private let backgroundLineView: UIView = UIView().then { | ||
$0.backgroundColor = .gray2 | ||
} | ||
|
||
let selectedUnderLineView: UIView = UIView().then { | ||
$0.backgroundColor = .black | ||
$0.layer.cornerRadius = 1 | ||
} | ||
|
||
override init(items: [Any]?) { | ||
super.init(items: items) | ||
|
||
setupSegment() | ||
setupTextAttribute() | ||
setupBackgroundLineView() | ||
setupBackgroundAndDivider() | ||
|
||
} | ||
|
||
required init?(coder: NSCoder) { | ||
fatalError() | ||
} | ||
|
||
private func setupSegment() { | ||
[ | ||
backgroundLineView, | ||
selectedUnderLineView | ||
].forEach { addSubview($0) } | ||
|
||
self.selectedSegmentIndex = 0 | ||
} | ||
|
||
private func setupBackgroundAndDivider() { | ||
self.setBackgroundImage(UIImage(), for: .normal, barMetrics: .default) | ||
self.setBackgroundImage(UIImage(), for: .selected, barMetrics: .default) | ||
self.setBackgroundImage(UIImage(), for: .highlighted, barMetrics: .default) | ||
|
||
self.setDividerImage( | ||
UIImage(), | ||
forLeftSegmentState: .selected, | ||
rightSegmentState: .normal, | ||
barMetrics: .default | ||
) | ||
} | ||
|
||
private func setupTextAttribute() { | ||
setTitleTextAttributes([ | ||
NSAttributedString.Key.foregroundColor: UIColor.gray3, | ||
NSAttributedString.Key.font: UIFont.pretendard(.body05) | ||
], for: .normal) | ||
setTitleTextAttributes([ | ||
NSAttributedString.Key.foregroundColor: UIColor.black, | ||
NSAttributedString.Key.font: UIFont.pretendard(.body05) | ||
], for: .selected) | ||
} | ||
|
||
private func setupBackgroundLineView() { | ||
backgroundLineView.snp.makeConstraints { | ||
$0.bottom.leading.trailing.equalToSuperview() | ||
$0.height.equalTo(2) | ||
} | ||
|
||
selectedUnderLineView.snp.makeConstraints { | ||
$0.bottom.leading.equalToSuperview() | ||
$0.width.equalToSuperview().dividedBy(numberOfSegments) | ||
$0.height.equalTo(backgroundLineView) | ||
} | ||
} | ||
} |
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,70 @@ | ||
// | ||
// PromiseViewController.swift | ||
// KkuMulKum | ||
// | ||
// Created by YOUJIM on 7/9/24. | ||
// | ||
|
||
import UIKit | ||
|
||
class PromiseViewController: BaseViewController { | ||
private let promiseViewModel = PromiseViewModel() | ||
|
||
private lazy var promiseSegmentedControl = PromiseSegmentedControl(items: ["약속 정보", | ||
"준비 현황", | ||
"지각 꾸물이"]) | ||
|
||
private let promisePageViewController = UIPageViewController(transitionStyle: .scroll, | ||
navigationOrientation: .horizontal) | ||
|
||
override func viewDidLoad() { | ||
super.viewDidLoad() | ||
} | ||
|
||
override func setupView() { | ||
view.backgroundColor = .white | ||
self.navigationItem.title = "기말고사 모각작" | ||
|
||
view.addSubview(promiseSegmentedControl) | ||
addChild(promisePageViewController) | ||
|
||
promiseSegmentedControl.snp.makeConstraints { | ||
$0.top.equalToSuperview() | ||
$0.leading.trailing.equalToSuperview().inset(-6) | ||
$0.height.equalTo(52) | ||
} | ||
|
||
promisePageViewController.view.snp.makeConstraints { | ||
$0.top.equalTo(promiseSegmentedControl.snp.bottom) | ||
$0.horizontalEdges.bottom.equalToSuperview() | ||
} | ||
|
||
promisePageViewController.didMove(toParent: self) | ||
} | ||
|
||
override func setupAction() { | ||
promiseSegmentedControl.addTarget(self, action: #selector(didSegmentedControlIndexUpdated), for: .valueChanged) | ||
} | ||
|
||
override func setupDelegate() { | ||
promisePageViewController.delegate = self | ||
promisePageViewController.dataSource = self | ||
} | ||
|
||
@objc private func didSegmentedControlIndexUpdated() { | ||
promiseSegmentedControl.selectedUnderLineView.snp.updateConstraints { | ||
$0.leading.equalToSuperview().offset((promiseSegmentedControl.bounds.width / CGFloat(promiseSegmentedControl.numberOfSegments)) * CGFloat(promiseSegmentedControl.selectedSegmentIndex)) | ||
} | ||
} | ||
} | ||
|
||
|
||
extension BaseViewController: UIPageViewControllerDelegate, UIPageViewControllerDataSource { | ||
func pageViewController(_ pageViewController: UIPageViewController, viewControllerBefore viewController: UIViewController) -> UIViewController? { | ||
return UIViewController() | ||
} | ||
|
||
func pageViewController(_ pageViewController: UIPageViewController, viewControllerAfter viewController: UIViewController) -> UIViewController? { | ||
return UIViewController() | ||
} | ||
} |
Oops, something went wrong.