Ramotion / expanding-collection

:octocat: ExpandingCollection is an animated material design UI card peek/pop controller. iOS library made by @Ramotion
https://www.ramotion.com/smartphone-app-development-ui-library-to-peek-and-pop-cards/
MIT License
5.55k stars 529 forks source link

How Can I Have The Second Container Show First #38

Closed JayBone16 closed 8 years ago

JayBone16 commented 8 years ago

How can I have the first index show instead of the zero index?

How It Shows Up When It Runs: screen shot 2016-10-10 at 2 37 31 pm

How I want it to start up like: screen shot 2016-10-10 at 2 37 35 pm

git-hwa commented 8 years ago

@JayBone16 Maybe you can manually select the item at the first launch.

self.collectionView?.selectItem(at: IndexPath(row: 1, section: 0), animated: true, scrollPosition: UICollectionViewScrollPosition.left)
0ber commented 8 years ago
override func viewWillAppear(_ animated: Bool) {
    super.viewWillAppear(animated)

    view.layoutIfNeeded()
    collectionView?.selectItem(at: IndexPath(row: <CURRENT_INDEX>, section: 0), animated: true, scrollPosition: .centeredHorizontally)
  }
JayBone16 commented 7 years ago

@ober01 Thanks it worked!