Skip to content

Commit

Permalink
feat: ✨calendar -> price 화면 이동(#42)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lia316 committed Jun 2, 2021
1 parent 4c18983 commit 6cc6e86
Show file tree
Hide file tree
Showing 3 changed files with 103 additions and 2 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ extension CalendarViewController {
])

let flexibleSpace = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: self, action: nil)
let toolbarItem1 = UIBarButtonItem(title: "건너뛰기", style: .plain, target: self, action: nil)
let toolbarItem2 = UIBarButtonItem(title: "다음", style: .done, target: self, action: nil)
let toolbarItem1 = UIBarButtonItem(title: "건너뛰기", style: .plain, target: self, action: #selector(nextButtonPressed))
let toolbarItem2 = UIBarButtonItem(title: "다음", style: .done, target: self, action: #selector(nextButtonPressed))

let items = [toolbarItem1, flexibleSpace, toolbarItem2]
items.forEach{ $0.tintColor = .black }
Expand All @@ -209,4 +209,9 @@ extension CalendarViewController {
self.navigationController?.navigationBar.topItem?.backBarButtonItem = backButton
}

@objc func nextButtonPressed() {
let nextVC = PriceViewController(conditionViewModel: conditionViewModel)
self.navigationController?.pushViewController(nextVC, animated: true)
}

}
96 changes: 96 additions & 0 deletions iOS/Airbnb/Airbnb/ConditionPage/Price/PriceViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,105 @@ import UIKit

class PriceViewController: UIViewController {


private var conditionViewModel: ConditionViewModel
private var containerView: UIView!
let label = UILabel()

init(conditionViewModel: ConditionViewModel) {
self.conditionViewModel = conditionViewModel
super.init(nibName: nil, bundle: nil)
}

required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

override func viewDidLoad() {
super.viewDidLoad()
view.backgroundColor = .white
configure()
configureContainer()
configureNavigation()
configureToolBar()
}


}


extension PriceViewController {

private func configure() {
view.addSubview(label)
label.translatesAutoresizingMaskIntoConstraints = false
label.adjustsFontForContentSizeCategory = true
label.numberOfLines = 0
label.font = UIFont.preferredFont(forTextStyle: .title1)

let inset = CGFloat(10)
NSLayoutConstraint.activate([
label.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: inset),
label.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -inset),
label.topAnchor.constraint(equalTo: view.topAnchor, constant: inset),
label.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: -inset)
])

}

}


extension PriceViewController {
private func configureContainer() {
containerView = UIView()
containerView.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(containerView)

NSLayoutConstraint.activate([
containerView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0),
containerView.topAnchor.constraint(equalTo: view.bottomAnchor, constant: -250),
containerView.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0),
containerView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0)
])
containerView.backgroundColor = .cyan
let vc = ConditionTableViewController(viewModel: conditionViewModel)
self.addChild(vc)
containerView.addSubview(vc.view)
}
}


extension PriceViewController {

func configureToolBar() {
self.tabBarController?.tabBar.isHidden = true
let toolbar = UIToolbar()
view.addSubview(toolbar)

toolbar.translatesAutoresizingMaskIntoConstraints = false

NSLayoutConstraint.activate([
toolbar.leadingAnchor.constraint(equalToSystemSpacingAfter: view.safeAreaLayoutGuide.leadingAnchor, multiplier: 0),
toolbar.bottomAnchor.constraint(equalToSystemSpacingBelow: view.safeAreaLayoutGuide.bottomAnchor, multiplier: 0),
toolbar.trailingAnchor.constraint(equalToSystemSpacingAfter: view.safeAreaLayoutGuide.trailingAnchor, multiplier: 0)
])

let flexibleSpace = UIBarButtonItem(barButtonSystemItem: .flexibleSpace, target: self, action: nil)
let toolbarItem1 = UIBarButtonItem(title: "건너뛰기", style: .plain, target: self, action: nil)
let toolbarItem2 = UIBarButtonItem(title: "다음", style: .done, target: self, action: nil)

let items = [toolbarItem1, flexibleSpace, toolbarItem2]
items.forEach{ $0.tintColor = .black }

toolbar.setItems(items, animated: true)
}

func configureNavigation() {
self.navigationItem.title = "숙소 찾기"
let backButton = UIBarButtonItem()
backButton.title = "Back"
self.navigationController?.navigationBar.topItem?.backBarButtonItem = backButton
}

}

0 comments on commit 6cc6e86

Please sign in to comment.