Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | ||||||
2 | 3 | 4 | 5 | 6 | 7 | 8 |
9 | 10 | 11 | 12 | 13 | 14 | 15 |
16 | 17 | 18 | 19 | 20 | 21 | 22 |
23 | 24 | 25 | 26 | 27 | 28 |
Tags
- 입력
- DISPATCH
- ios
- BidirectionalCollection
- AVCaptureSession
- input
- 공백
- ReactorKit
- readLine
- 사내배포
- RxSwift
- async
- URLSession
- binder
- UserDefaults
- swift
- moya
- hitTest
- reversed
- Asnyc
- weak self
- 전자출입
- Custom Class
- UIResponder
- Combine
- delays deallocation
- Python
- MaxHeap
- Responder chain
- vtable
Archives
- Today
- Total
틈틈히 적어보는 개발 일기
[iOS][Swift] View Animation 구현하기 본문
UIVIew.animate apple공식문서
View에 animation 추가하기
아래의 코드를 button의 action에 추가합니다.
UIView.animate(withDuration: 0.5,
delay: 0.1,
options: .curveEaseInOut,
animations: { () -> Void in
self.extendView.frame = CGRect(x: 0, y: 0, width: UIScreen.main.bounds.width, height: 350)
},
completion: { (didFinish) -> Void in
})
withDuration -> 몇 ’초’ 동안 animation을 보여 줄 것인지 정합니다.
delay -> animation을 시작하기 전 delay를 정합니다.
options -> animation의 커브값을 지정해줍니다.
이렇게 등속으로 움직이는 animation이 아닌 부드러운 느낌을 줍니다.
해당 사이트는 이곳 에서 참고가 가능하며 기본적으로 Xcode에서 지원을 합니다!
animations -> animation을 적용합니다.
completion -> 해당 animation작업이 끝난 후 필요한 작업이 있다면 작성합니다.
반대로 뷰가 사라지거나 줄어드는 animation을 원한다면 height값을 조절하면 됩니다.
'📱 iOS, Swift' 카테고리의 다른 글
[iOS][Swift] Responder Chain, hitTest, point (hitTest, point의 호출 로직) (1) | 2022.03.06 |
---|---|
[iOS][Swift] Final 키워드에 관한 문법적 의미와 성능적 관점 (1) | 2022.01.24 |
[iOS][Swift] QRCode 리더, 스캐너를 만들어 보자! (1) | 2021.02.08 |
[iOS][Swift] 커스텀 클래스를 UserDefaults에 저장해보기, Singleton 패턴 적용하기 (0) | 2021.01.05 |
[iOS][Swift] Ad-Hoc, In-House 배포와 관련된 이슈 정리 (0) | 2020.06.08 |
Comments