TextureGroup / Texture

Smooth asynchronous user interfaces for iOS apps.
https://texturegroup.org/
Other
8.02k stars 1.3k forks source link

ASPagerNode minimumSpacing is unusable #1323

Open zboralski opened 5 years ago

zboralski commented 5 years ago

If minimumLineSpacing is set, every page has a gap and shifts to the right.

ASPagerNode without minimumLineSpace looks terrible and I am surprised no-one bumped into this issue.

This is the only solution I came up with that works:

  override func viewDidAppear(_ animated: Bool) {
    super .viewDidAppear(animated)
    let spacing: CGFloat = 10.5
    layout.minimumLineSpacing = spacing
    layout.itemSize = view.frame.size
    layout.sectionInset = UIEdgeInsets(top: 0, left: 0, bottom: 0, right: spacing)

    node.view.frame = CGRect(x: 0, y: -spacing/2, width: view.frame.width + spacing, height: view.frame.height)
    node.scrollToPage(at: 1, animated: false)

and this only works if layout.minimumLineSpacing is originally set to zero!

zboralski commented 5 years ago

The above solution doesn't work if I implement scrollViewDidScroll(_ scrollView: UIScrollView)

why?