Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Fix] #484 - 습관방 이용가이드 닫기 버튼 분기처리 #486

Merged
merged 2 commits into from
Apr 5, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ class HabitRoomGuideVC: UIViewController {
// MARK: - Properties

var dismissClousure: (() -> Void)?
var fromMore: Bool = false

private let popupView = UIView()
private let titleLabel = UILabel()
Expand Down Expand Up @@ -58,7 +59,12 @@ class HabitRoomGuideVC: UIViewController {
closeButton.setTitle("닫기", for: .normal)
closeButton.setTitleColor(.sparkPinkred, for: .normal)
closeButton.titleLabel?.font = .krBoldFont(ofSize: 16)
closeButton.alpha = 0

if fromMore {
closeButton.alpha = 1
} else {
closeButton.alpha = 0
}

pageControl.numberOfPages = 3
pageControl.pageIndicatorTintColor = .sparkLightGray
Expand Down Expand Up @@ -130,7 +136,7 @@ extension HabitRoomGuideVC: UICollectionViewDelegate {

// 스크롤뷰 드래그 시작될때, closeButton이 hidden 상태가 아니라면 hidden 시켜주기
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
if !closeButton.isHidden {
if !closeButton.isHidden && !fromMore {
UIView.animate(withDuration: 0.1) {
self.closeButton.alpha = 0
}
Expand All @@ -139,12 +145,14 @@ extension HabitRoomGuideVC: UICollectionViewDelegate {

// 스크롤뷰 드래그가 멈췄을때, 마지막 content라면 닫기 버튼 보이기
func scrollViewDidEndDecelerating(_ scrollView: UIScrollView) {
if scrollView.contentOffset.x == scrollView.contentSize.width - scrollView.frame.size.width {
UIView.animate(withDuration: 0.2) {
self.closeButton.alpha = 1
if !fromMore {
if scrollView.contentOffset.x == scrollView.contentSize.width - scrollView.frame.size.width {
UIView.animate(withDuration: 0.2) {
self.closeButton.alpha = 1
}
} else {
closeButton.alpha = 0
}
} else {
closeButton.alpha = 0
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@ extension HabitRoomVC {
guard let guideVC = UIStoryboard(name: Const.Storyboard.Name.habitRoomGuide, bundle: nil).instantiateViewController(withIdentifier: Const.ViewController.Identifier.habitRoomGuide) as? HabitRoomGuideVC else { return }
guideVC.modalPresentationStyle = .overFullScreen
guideVC.modalTransitionStyle = .crossDissolve
guideVC.fromMore = true

self.present(guideVC, animated: true, completion: nil)
}
Expand Down