Answers for "swift scrollview scroll to page"

1

swift collectionview scrolltoitem

self.collectionView.scrollToItem(at:IndexPath(item: indexNumber, section: sectionNumber), at: .right, animated: false)
Posted by: Guest on March-25-2020
0

swift paged scrollview get current page

// Swift 5

self.scrollView.delegate = self

// Changed the page property when the user scrolls over 50% of the current page.
// Page starts with 0
func scrollViewDidScroll(_ scrollView: UIScrollView) {
  let scrollViewWidth = scrollView.bounds.width
  self.page = Int(round(scrollView.contentOffset.x / scrollViewWidth))
}

var page: Int {
    didSet {
        guard oldValue != self.page else {
          return 
        }
      	// Handle page update
    }
}
Posted by: Guest on January-19-2022

Code answers related to "swift scrollview scroll to page"

Code answers related to "Swift"

Browse Popular Code Answers by Language