Skip to content

Commit

Permalink
QA : SortType Select 화면 dismiss 로직 추가 구현
Browse files Browse the repository at this point in the history
  • Loading branch information
wan088 committed Jan 8, 2021
1 parent a1194f8 commit 3324e7a
Showing 1 changed file with 24 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public final class SortTypeSelectController: UIViewController {
private var sortTypeTableView: UITableView = UITableView()
private let exitButton: UIButton = UIButton()
private var selectedSortType: Message.Model.ListType? = nil
private let outsideView: UIView = UIView()
let disposeBag: DisposeBag = DisposeBag()

override public func viewDidLoad() {
Expand All @@ -29,7 +30,19 @@ public final class SortTypeSelectController: UIViewController {

// MARK: 🎛 Setup
private func setupUI() {
self.view.do {
let insideView: UIView = UIView()
self.view.addSubview(insideView)
insideView.snp.makeConstraints {
$0.height.equalTo(500)
$0.bottom.leading.trailing.equalToSuperview()
}
self.view.addSubview(outsideView)
outsideView.snp.makeConstraints {
$0.top.leading.trailing.equalToSuperview()
$0.bottom.equalTo(insideView.snp.top)
}

insideView.do {
$0.backgroundColor = .white
$0.layer.masksToBounds = true
$0.layer.cornerRadius = 15
Expand All @@ -38,15 +51,15 @@ public final class SortTypeSelectController: UIViewController {
$0.setImage(UIImage(named: "cancel"), for: .normal)
$0.tintColor = .warmBlue
}
self.view.addSubview(exitButton)
insideView.addSubview(exitButton)
self.exitButton.snp.makeConstraints {
$0.size.equalTo(12)
$0.top.trailing.equalToSuperview().inset(20)
}
self.sortTypeTableView.do {
$0.backgroundColor = .white
}
self.view.addSubview(self.sortTypeTableView)
insideView.addSubview(self.sortTypeTableView)
self.sortTypeTableView.snp.makeConstraints {
$0.top.equalTo(exitButton.snp.bottom).offset(10)
$0.trailing.leading.bottom.equalToSuperview()
Expand All @@ -68,6 +81,13 @@ public final class SortTypeSelectController: UIViewController {
}
.disposed(by: self.disposeBag)

self.outsideView
.rx.tapGesture()
.bind { _ in
self.willMove(toParent: nil)
}
.disposed(by: self.disposeBag)

Observable.just(self.sortTypes)
.bind(to: self.sortTypeTableView.rx.items) { [weak self] (tableView, row, item) -> UITableViewCell in
guard let self = self else { return UITableViewCell()}
Expand Down Expand Up @@ -132,7 +152,7 @@ extension SortTypeSelectController {
presented.view.frame.origin.y = base.view.frame.height
UIView.animate(withDuration: 0.3) {
presenting.view.alpha = 0.6
presented.view.frame.origin.y = base.view.frame.height - 500
presented.view.frame.origin.y = 0
} completion: { _ in
presented.didMove(toParent: base)
}
Expand Down

0 comments on commit 3324e7a

Please sign in to comment.