- ์คํฌ๋กค๋ง, ์ค์, ์คํฌ๋กค์ ๊ฐ์, ์คํฌ๋กค ์ ๋๋ฉ์ด์ ๊ฐ์ ์์ ์ ๋ฐ์ํ๋ ๋ฉ์๋๋ค
protocol UIScrollViewDelegate๊ณ์ ์ถ๊ฐ ์์
func scrollViewDidScroll(_ scrollView: UIScrollView) {
// Tells the delegate when the user scrolls the content view within the receiver
}ํน์ง: offset ๊ฐ์ด ๋ฐ๋ ๋ ๋ง๋ค ํธ์ถ๋๋ฏ๋ก ์ด์ง๋ง ์คํฌ๋กคํด๋ ๊ณ์ ํธ์ถ๋จ
func scrollViewWillBeginDragging(_ scrollView: UIScrollView) {
// called on start of dragging (may require some time and or distance to move)
}ํน์ง: : ์คํฌ๋กค๋ทฐ์์ ๋๋๊ทธํ๊ธฐ ์์ํ ๋ ํ ๋ฒ๋ง ํธ์ถ๋จ
func scrollViewWillEndDragging(_ scrollView: UIScrollView, withVelocity velocity: CGPoint, targetContentOffset: UnsafeMutablePointer<CGPoint>) {
// called on finger up if the user dragged. velocity is in points/millisecond. targetContentOffset may be changed to adjust where the scroll view comes to rest
}ํน์ง : ์์ ๋ ์ ๋ ํ ๋ฒ ํธ์ถ๋๊ณ , ๊ทธ ๋์ ์๋(๋ฐฉํฅ ํฌํจ)๋ฅผ ์ ์ ์๋ค.
func scrollViewDidEndDragging(_ scrollView: UIScrollView, willDecelerate decelerate: Bool) {
// called on finger up if the user dragged. decelerate is true if it will continue moving afterwards
}ํน์ง : ์์ ๋ ์ ๋ ํ ๋ฒ ํธ์ถ๋๊ณ , ํ ์ด๋ธ ๋ทฐ์ ์คํฌ๋กค ๋ชจ์ ์ ๊ฐ์ ์ฌ๋ถ๋ฅผ ์ ์ ์๋ค.