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?
Related
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?
I have a UICollectionView that scrolls horizontally. As I scroll left or right I would like to be able to determine when the most left or first cell is say, 60% off the screen and 40% on screen.
Eventually, I would like to do the same for when I scroll to the right and determine the same for the last cell or most right cell.
Thanks for the help.
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?
In my cell subclass the user can slide the cell for actions, just like in Mail.app. However, the cells can be much larger than Mail.app, sometimes up to 1,000pt which means it requires the table to be scrolled to read fully.
This means that the normal strategy of simply centering the actions vertically in the cell will not work, as the vertical center could very well not be visible. So I want to display it in the vertical center of the visible area.
Is this possible to do within the UITableViewCell subclass where the sliding action is occurring? Figuring out where the vertical center of the visible area even is?
I have a slightly complicated system that I am having some reuse issues with, wanted to get some feedback. Basically it is a vertical tableview, and each cell contains another tableview that is rotated 90 degrees, so that each cell scrolls horizontally. Each horizontal cell is also set up to scroll infinitely with paginated responses from an API. I am having issues where cells are copying on top of each other when the vertical table is scrolled down. I have reuse identifiers set up correctly and in each of the horizontal tableviews I am running the following:
- (void)prepareForReuse
{
[_horizontalTableView reloadData];
}
If I turn off reusing cells the issue doesn't happen, but the vertical scrolling performance suffers. I am wondering if its possible that reusing cells in this type of a set up just isnt possible? Any experience with this is helpful. Thanks.
This is not a direct way to solve your issue, but I believe if you use a horizontal scroll view inside each vertical cell, you will have this done faster and with less weird behaviours. I also believe this is not a standard way, so weird stuff will happen.
All you do is set or extend the content size of the scroll off screen continuously to create an infinite scrolling behaviour. Create views within the scroll view pragmatically to simulate each cell. Hope this helps.