I have implemented a UICollectionView cell which can be scrolled horizontally. While scrolling, is it possible to detect which cell(index) is passing the first cell(among all visible cells in UICollectionView)??
I don't know whether I cleared my question. You can see the following picture...
Related
I am working on a quite complicated case
I have a nested UICollectionView
The outer UICollectionView A is for vertical scrolling,
and it's the first cell, is UICollectionView B, for horizontal scrolling.
It has been implemented perfectly, but now there is one more requirement
When scrolling the first cell to the second page, there is one more banner appeared on the bottom of the first cell.
Therefore I need to update the height of cell when scrolling.
If I try to call invalid layout when scrolling, it will be very low efficient. Are there any more methods to support it?
Solved.
First after received the data from the server, each cell height will be calculated and [collectionview reload] will be called.
Then after layouting the collectionview, the size for each cell is cached according to the indexpath.
To implement the 'realtime' resizing, the gesture will call a resizing function directing through a delegate, and directly modify the size cache and call [collectionview.layout invalidlayout].
It looks smooth.
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?
I have a tableView with 20 tableViewCells and within each cell I insert a collectionView (with 100 cells) which scrolls horizontally. I would like to scroll ALL collectionViews when any of the collectionViews is scrolled.
Implementation
I have subclassed the collectionView and have overridden scrollView delegates.
I have currently gotten this to work with the following approaches:
When ANY CollectionView is scrolled, I get all visible tableViewCells and grab the collectionsViews within each cell and set the collectionView contentOffsets iteratively or by using makeObjectsPerformSelector.
Had a CGPoint property with an observer which triggers when the property changes; then inside the collectionView subclass scrollViewDidScroll: I set the property, this will trigger the observer and set the collectionView accordingly. (the collectionView contentOffset is set inside observeValueForKeyPath:ofObject:change:context:)
I have also used NSNotificationCenter to broadcast any scroll and in-turn scroll every other listener
The problem I face is that the collectionViews scrolls are a bit glitch sometimes especially when the scroll is coming to a halt. currently there is no data in collectionView cells but it glitches.
Please does anyone know of a way to simultaneously scroll multiple collectionViews without glitches.
Thanks in advance.
in my app i have a UICollectionView and UIPageControl inside UITableViewCell. UICollectionView has three different kind of cells and each cell covers the full width of iPhone. With accessibility on we are facing a problem when the focus is on UIPageControl and we try to adjust its value by swiping up and down and then traverse back to the cell it loses its focus and takes us to some different cell instead of taking control to the cell which we have changed using UIPageControl.
We are changing the cell on value change event of UIPageControl.
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