VerticalCardSwiper | A marriage between the Shazam Discover UI and Tinder | iOS library
kandi X-RAY | VerticalCardSwiper Summary
kandi X-RAY | VerticalCardSwiper Summary
A marriage between the Shazam Discover UI and Tinder, built with UICollectionView in Swift.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of VerticalCardSwiper
VerticalCardSwiper Key Features
VerticalCardSwiper Examples and Code Snippets
Community Discussions
Trending Discussions on VerticalCardSwiper
QUESTION
I've been breaking my head over this for the past few weeks and I'm out of ideas..
Short backgroundI built my own UICollectionView
framework with a custom UICollectionViewFlowLayout
for vertical card paging and creating a card stack effect.
Here's a gif of what it looks like:
ProblemI'm trying to implement a feature that allows the user to scroll to a specific card at a specific index (using the scrollToItem
function for example).
Now the problem is that for some reason, when trying to scroll back to the previous card it doesn't work correctly.
Below is a recording of what happens, I've attached a tapGestureRecognizer to it, when I tap the focussed (currently centered) card, it should scroll to that index - 1 (so the previous card).
For some reason it only does this once the frame.origin.y
of the bottom card is above the frame.origin.maxY
of the focussed (currently centered card).
Notice that I'm tapping twice on the card to make it work, because the frame.origin.y
value of the bottom card needs to be lower than the frame.origin.maxY
of the top card for some reason for it to work.
ANSWER
Answered 2019-Jan-08 at 10:33I've managed to get it to work another way, by using setContentOffset
and calculating the offset manually.
QUESTION
I'm facing a weird issue that I can't seem to figure out or find anything about online.
So I'm trying to replicate the Shazam discover UI with a UICollectionView
and a custom UICollectionViewFlowlayout
.
So far everything is working pretty well, but when adding the "card stack" effect I (or rather the person who was implementing it) noticed there seems to be a weird issue where on some occasions (or rather, when specific indexes are visible, in the example it's row 5, 9) there will be 4 visible cells instead of 3. My guess would be that this has something to do with cell reuse, but I'm not sure why it's doing this. I looked into the individual cell dimensions and they all seem to be the same so it's not that cells are just sized differently.
Does anyone have an idea as to why this could be happening? Any help or suggestions are really appreciated.
I'll add a code snippet of the custom flowlayout and screenshots below. You can download the full project here, or alternatively, check out the PR on Github.
Here's a visual comparison:
Source code of the custom flowlayout:
...ANSWER
Answered 2018-Oct-10 at 20:01You have a layout that inherits from flow layout. You overrode layoutAttributesForElements(in rect:)
where you take all the elements from super.layoutAttributesForElements
and then for each one modify the properties in the method updateCellAttributes
.
This is generally a good way to make a subclass of a flow layout. The UICollectionViewFlowLayout
is doing most of the hard work - figuring out where each element should be, which elements are in the rect, what their basically attributes are, how they should be padded, etc, and you can just modify a few properties after the "hard" work is done. This works fine when you are adding a rotation or opacity or some other feature that does not change the location of the item.
You get into trouble when you change the items frame with updateCellAttributes
. Then you can have a situation when you have a cell that would not have appeared in the frame at all for the regular flow layout, but now SHOULD appear because of your modification. So the attribute is not being returned AT ALL by super.layoutAttributesForElements(in rect: CGRect) so they don't show up at all. You can also have the opposite problem that cells that should not be in the frame at all are in the view but transformed in a way that cannot be seen by the user.
You haven't explained enough of what effect you are trying to do and why you think inheriting from UIFlowLayout is correct for me to be able to specifically help you. But I hope that I have given you enough information that you can find the problem on your own.
QUESTION
I'm trying to recreate the Shazam Discover UI by subclassing UICollectionView
/UICollectionViewFlowLayout
.
I've got as far as paging the cells and making them the right size, however, I'm having trouble getting the cells to scroll to the background, as in, I don't have a clue on how to get it done, I've searched everywhere but can't seem to find it.
An example of what I'm trying to achieve:
Any help/tips on how I could do this would be greatly appreciated.edit: I ended up building my own solution: https://github.com/JoniVR/VerticalCardSwiper
...ANSWER
Answered 2017-Aug-08 at 07:18You could use third party libraries to achieve the same. You may use StickyCollectionView. This is an Objective C based library. I believe this one with some customization will help you to approve this.
QUESTION
So I need a bit of help since I can't really figure it out and have spent a lot of time on it already without any results. Most of the things I find on the internet are on how to convert a swift project into a framework, but my issue isn't the project itself or cocoapods, it's about how and what I should make accessible to developers.
So I built a Swift framework which you can find here, it's built with a UICollectionView
with a custom flowlayout
and side swiping functionality.
The problem is that I don't know how I can make this easy to use for developers, I'd like to make it behave like a UICollectionView
where you'd need to implement a custom delegate and datasource without having to use the default UICollectionViewDelegate
and UICollectionViewDatasource
, so I can filter out things that would cause unexpected behaviour or just keep things simple.
So what would be a good approach here? I'm thinking about possibly subclassing the UICollectionView
so people don't have to use a UICollectionView
(because that might get confusing) but a VerticalCardSwiperView
instead which has the same behaviour, but a bit more limited. I just don't know if that's the correct approach here.
Any tips, insights or good examples would be deeply appreciated!
edit 1: I updated the project so it already has the framework structure, I just need to figure out how I'm going to give access to the custom parts to developers.
edit 2: I have gotten one answer but I think the question might be easily misunderstood. The goal is to make it act and behave like a UICollectionView
(with delegates, datasource, ...) but more limited, and I'm wondering how I can accomplish that, if it's even possible.
edit 3: Alright, I have most of it working, I'll leave a link to the Github online here so people who need something similar can check it out for themselves. Essentially, what I've done is made a custom VerticalCardSwiperDelegate
and VerticalCardSwiperDatasource
like this:
ANSWER
Answered 2018-May-17 at 11:18It looks great!
I'd say that if you want to expose UICollectionView
then follow the UITableView
and it's approach with the UIScrollView
subclassed delegates.
QUESTION
So I'm trying to build an open source library combo between Shazam Discover and Tinder based on a UICollectionView
with a custom UICollectionViewFlowLayout
.
I'm having an issue where, after animating a cell the the side (e.g. swiping it away to the side), the cell will stay in that position when it is being reused by the UICollectionView
. (I'm guessing that cell reuse is the issue here since it only seems to happen after scrolling a couple of cells)
Is there any simple way to fix this behavior? Or am I doing something else wrong here? Been looking at it for a couple of days but can't seem to find a fix myself.
You can try/check out the code on Github
I tried posting some code snippets but I'm not sure which ones I should post here since it's a lot of code. If I should post code on here, let me know.
Any help is much appreciated. Have a nice day :)
Here's a demo of what's happening:
...ANSWER
Answered 2018-Jan-23 at 12:01Outside of the cell class, in HomeVC
, where you handle panning to swipe the card away you manipulate also the layer's anchorPoint
- you need to reset that to make drawing work as before:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install VerticalCardSwiper
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page