iOSkingkr / Giftatte22

선물 어플을 개발할꺼에요
3 stars 0 forks source link

시작화면 트렌지션 추가, 나이별 카테고리 로직 수정 #25

Closed DevKDuck closed 2 years ago

DevKDuck commented 2 years ago

1. 시작화면에 로띠애니메이션을 보여준 후 modaltransitionstyle을 사용하려 했으나 알맞은 트렌지션 스타일이 없어 트렌지션을 커스텀함

import UIKit

class TransitionHandler : NSObject, UIViewControllerAnimatedTransitioning, UIViewControllerTransitioningDelegate {

    func animationController(forPresented presented: UIViewController, presenting: UIViewController, source: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        return self
    }
    func animationController(forDismissed dismissed: UIViewController) -> UIViewControllerAnimatedTransitioning? {
        return self
    }

    func transitionDuration(using transitionContext: UIViewControllerContextTransitioning?) -> TimeInterval {
        return 0.9
    }

    func animateTransition(using transitionContext: UIViewControllerContextTransitioning) {
        let container = transitionContext.containerView
        let fromView = transitionContext.view(forKey: .from)!
        let toView = transitionContext.view(forKey: .to)!
        let offScreenLeft = CGAffineTransform(translationX: 0, y: 0) // (-container.frame.size.width,0)
        let offScreenRight = CGAffineTransform(translationX: container.frame.size.width, y: 0)
                toView.transform = offScreenLeft
                container.addSubview(toView)
                container.addSubview(fromView)
                let duration = self.transitionDuration(using: transitionContext)

                UIView.animate(withDuration: duration, delay: 0.0, usingSpringWithDamping: 0.9, initialSpringVelocity: 0.8, options: [], animations: {

                    fromView.transform = offScreenRight
                    toView.transform = CGAffineTransform.identity

            }, completion: { finished in

                    transitionContext.completeTransition(true)
            })
    }
}

2. price의 가격대가 사용자 입장에서 선택 폭이 적은 것 같아 가격대를 수정하였음

수정전

3. age 별로 출산이나 입학,졸업처럼 필요없는 카테고리가 있다는 것을 알게되어 로직수정함