Group Group Group Group Group Group Group Group Group

Chapter 44 - Landscape

I’m trying to customize a scroll view for a horizontal view for iPhone 11. I want to have the right side rectangles further away from the top-notch which I have done. The problem is that if I do a hard scroll to the left, it keeps bouncing back a little off of the original position.

When the view loads:

After I do the hard scroll to the left:

Here is my code that I think all you need to see

override func viewWillLayoutSubviews() {
   let safeFrame = view.safeAreaLayoutGuide.layoutFrame
   scrollView.frame = safeFrame
}

   func setButtons(searchResults: [SearchResults] {
        case 724:
            //iPhone X, iPhone 11 Pro
            columnsPerPage = 8
            rowsPerPage = 3
            itemWidth = 90
            itemHeight = 98
            marginX = 2
            marginY = 29
            scrollView.frame.origin.x = 25
            scrollView.contentOffset.x = 19
   }
     
   let buttonsPerPAge = columnsPerPage * rowsPerPage
   let numPages = 1 + (searchResults.count - 1) / buttonsPerPAge
   scrollView.contentSize = CGSize(width: CGFloat(numPages) * viewWidth, height: scrollView.bounds.size.height)