Snap to cell in a UICollectionView - ios

I am currently using a CollectionView within my UIViewController that scrolls horizontally through a variable number of cells (There are 3 cells visible on the display at a time). I want it so that when the user finishes scrolling that the view smoothly snaps/pulls to the cell closest to the center of the screen. Does anyone have suggestions on how this could be done?

Related

Swift collectionView hiding layout guidance

I am looking to create a certain layout with a collection view. Where there are 2 sections to the main viewController, the first being static on the page, and the second being a collectionView which moves over the other when the user scrolls. I want the collectionView to have a limit of how much it cover the static content (it should have a minimum and maximum inset that it can covert). The collectionView has a button which "hangs over" the static section. I have attached some images to describe this further.
I have thought of a few ways to achieve this, the most promising being a collectionView with a top contentInset of the 'max scrolled down' height. This would show the content underneath and allow the collectionView to be scrolled up and cover it. the button which "hangs over" would be a subview of the collectionView and would also show the rounded corners and drop shadow.
Problems:
couldn't continue scrolling the collection view whilst also pinning the header to the top
If anyone has any suggestions of how to go about this, please let me know! Thank you.

UICollectionView specific cell bring front of oder cell

As you can see in below video, in collectionView there are 3 cells. I want it become bigger when I touch in centre. everything is OK except one thing.
As you can see in video when order cell is visible and centre cell is bigger in bring to back of visible cell and make it untouchable.
https://www.dropbox.com/s/cn4ujvr6t9f9e2c/ScreenRecording_07-14-2018%2013-08-04.MP4?dl=0
Is there any solution that centre cell always be in front of order cell?

UICollectionView scroll whole page

I have a viewController with some text and under it a UICollectionView (about 50% of the page).
My problem is that when I scroll on the collectionView just the cells are being scrolled and not the whole page (the text + the collection cells).
You can think about it like on Instagram profile page (half info half collectionView), when you scroll on Instagram everything is being scrolled and not just the collection cells.
Anyone knows how can I do it?
Thanks!
Add the text content as separate cells on top of the UICollectionView.
Preferably, create a different section which would contain the cells with the top text.
Keep the backgroundColor/backgroundImage of these cells plain to give the effect that they are simply added as UILabels on a form. Doing so will also differentiate from the rest of the actual UICollectionViewCells.
Now, when you scroll the UICollectionView. It will give an effect that the text along with the cells are scrolled.
In Attribute inspector > Scroll View > check Paging enable
Thats because your text/UILabels doesn't belong within the UIScrollView of your UICollectionView, thus it will not be scrolled when the collectionView is. You could create a UICollectionViewCell for your text, include it within your collectionview and expand the collectionView to fit the screen or use a UICollectionViewController

Custom tableView cell with parallax scroll

I have to do next task: in my app I have 1 tableView with 4 custom cells. At drag down, first cell should stretch and his content need to be always at center. When i lift finger, cell returns at its standard size. The same thing with last one, when the bottom of the tableView is reached, last cell should stretch. I found many solutions, but all of them are explained how to do this with the bottom of table, but not with cell. I need to do this programmatically, any help will be great.
Examples that i found:
1) https://github.com/BillCarsonFr/ScrollviewParallax
2) https://github.com/nrj/StretchyHeaderCollectionViewLayout

How to allow UICollectionView to scroll in intervals of the cell width

I have a UICollectionView that scrolls sideways. When it is scrolled I want it to land on a multiple of the cell width. The cells are diamonds and must fit in a very precise location.
Example: If user scrolls, then the scroll will happen as normal (or maybe semi-paged) and then when it stops, make sure it stops at a multiple so the cell can be aligned with the diamonds.
Any idea how to approach this?

Resources