How to enlarge individual cells while scrolling in UICollectionView? - ios

I have a UICollectionView which has scrolling direction of horizontal. What I want to achieve is that when the UICollectionView is scrolled I want individual cells to enlarge there size. For example like the album Art work view in old iOS music app.

If you want something similar to "OLD IOS music app" art work view, then the easiest way I think would be to implement "scrollViewDidScroll" delegate method, then inside of "scrollViewDidScroll" get all visible cells of your collection view, and depending on their offset set CGAffineTransformScale.

Related

CollectionView Cell inside UITableView is not scrolling horizontally for Voice Over accessibility

In my app, I have a screen where I need to support voice over accessibility. The screen has a TableView and inside that a collectionView. When voice over is ON and when I try to single or three fingers swipe, the collectionView scroll is not working. The accessibility focus is not moving to the next cell. Voice over is working fine only for visible cells in collectionView.
I tried by disabling accessibility for collectionView Cell and UITableViewCell but still, it didn't work.
I want to make it work like in the AppStore, where we will have a similar kind of design.
I am attaching screenshots of my screen and some codes.
On your country cell on awakeFromNib function or your init function depends how you initialize the cell add the line self.contentView.isUserInteractionEnabled = false after super call.
The purpose of your screen isn't really clear to me but I can suggest an interesting way to use collection views with VoiceOver:
Define a UIAccessibilityElement to be inserted as a carousel element (element of your collection view).
Set its trait to .adjustable in order to select the different elements by swiping right or left.
Adapt the label and the value according to the selected cell.
Define the collection view [accessibilityElements].
It may be tedious 😓 but that's what Apple's engineers recommend ⟹ a complete and detailed example is introduced in a WWDC session, don't hesitate to take a look at it to perfectly implement your collection view for the VoiceOver users. 👍
what you need is just to say to tableview cell that your collection is accessible doing something like this:
accessibilityElements = [collectionView]

Horizontal Parallax Effect - Relative motions between views

I need a parallax scrolling effect. Something like Make My Trip app home page screen.
Any suggestion please. Demos or examples.
You can create two collectionviews with different item sizes and minimumInteritemSpacing.
Keep user interaction enabled for the collectionview at front but disable it for the other collection view.
On horizontal scroll of front collectionview, scroll the rear collectionview as well.
You can use scrollViewDidScroll method for this and scroll the rear collectionview accordingly.

Scroll horizontally in UITableView - Swift 3, iOS

I need to horizontally scroll through a list of thumbnails at the bottom of the screen that shows all the user's recently taken photos / videos.
I created a UIScrollView with a UITableview inside of it.
Is this the correct approach because I can't seem to find an override method in its superclass for scrolling direction?
Most of the topics I can find online deals with putting a UIscrollview inside a TableCell, which will not work for my specific application?
The hierarchy is:
View > Scroll View > Table View > Table Cel > Content > PhotoThumbnail
Below is a screenshot of what I'm trying to do:
I am not really sure why do you want to use UITableView for horizontal scrolling which lay out there cells in vertical manner. If you want horizontal scrolling I would recommend using UICollectionView where cells can be added horizontally or vertically or both.
Still if you want tableview to be scrollable in horizontal direction I would suggest you to check this project to get inspiration or using it.
https://github.com/alekseyn/EasyTableView
Instead of using UITableView you can use UICollectionView to achieve the desired result i.e, horizontally scrollable cells with imageView and other elements that you need.

UICollectionView inside UITableViewCell scroll behaviour

I'm trying to implement something similar to iTunes Store UI.
As you can see from the picture, there are two directions of scrolling possible. But I would like to prioritise scrolling of UICollectionView which is to the left or right because currently scroll down and scroll left/right are conflicting and causing weird behaviour.
Way to duplicate:
Scroll Down UITableView and then quickly try to swipe right or left on UICollectionView. UITableView will continue to scroll.
How can I do so? Do I need to use GestureRecognizer?
I always avoid collection view as it provides less flexibility to work with auto layout compared to a table view, however not against collection view every time. You should try the adding collection view inside a table view
There is a number of tutorials available for the same. eg (ios 8 Swift - TableView with embedded CollectionView)

Imitate the combined horizontal and vertical scrolling in the iOS iTunes store

I'm trying to create a screen similar to that in the new iTunes store:
That is, a grid that's scrollable both horizontally and vertically.
The first approach I've tried involved creating a UITableView (for the vertical rows) and, within each UITableViewCell of that UITableView, another UITableView that's rotated 90 degrees.
This seems to work visually but I'm not able to scroll vertically. I believe the gesture recognizers from the subview tables are preventing the gesture recognizers from the parent table view from receiving touch events.
Basically, the rows scroll horizontally but not vertically.
The next approach I've thought then is to create UISrollViews for each row but I was wondering if there's something I've missed?
Has anyone else encountered this issue in the past?
I have done something similar to what you have with table view inside a table view, I made the rotated 90° table view the parent instead. I think I also had to turn off scrolling for one table views when scrolling is detected in the other table view, and visa-versa.
If your trying to target below iOS 6.0, ruling out using the UICollectionView, I would try using GMGridView:
https://github.com/gmoledina/GMGridView
It's very complete and has many features. It also has horizontal paging support which may achieve what you are looking for.
You should have a look at UICollectionView.
Never tried to build something like that but... Idea :
One tableview, n-cell, each cell embed a scrollView wich can contains, n-subviews.

Resources