UIPageViewController with a Table View, inside an UITableView - ios

I want to replicate this sort of UX, like in the product hunt app
I want a few scroll pages inside a tableview
I tried to replicate creating a tableview with some static cell and a cell with a container view inside that is referred to a page controller, but I have a lot of problems adjusting frames
Do you have some advices or more straightforward methods to replicate this ux?
Imagur Link to the Gif of the UX

You can achieve this effect with the help of these two libraries.
For Parralax TableView header :
https://github.com/Vinodh-G/ParallaxTableViewHeader
For horizontal scroll effect:
https://www.cocoacontrols.com/controls/instagram-feed-view

Related

How to create a TableViewCell with multiple UICollectionViews within it?

Hi I'm currently attempting to create a very complex TableViewCell which will be used once and presented at the top of our TableView. The view consists of
4x UILabel
2x UICollectionView
1x UIImage
I'm wondering whether this is feasible and what the best way to approach this is?
I'm open to this not being a UITableViewCell but we want this to seamlessly scroll with the rest of the TableView, putting this within its own container above the TableView and within a UIScrollView was pretty messy as we had to handle the scrolling for both the scroll view and the tableview.
OK - my suggestion would be...
Create a new ViewController - MyHeaderViewController
Layout this view, including the 2x UICollectionView
Get it working on its own
Once you've got that part going...
Create a new ViewController (can be a UITableViewController, or a UIViewController with a UITableView added)
add code in this controller to load MyHeaderViewController, and then set the tableHeaderView = myHeaderVC.view
That let's you keep all the logic for the Collection Views separate from the TableView
See https://github.com/DonMag/SWTableHeaderView for a simple example.

How to build this layout in Swift

I'm working on an app that has one page where it should be an image at the top and then a table underneath it. The thing is that when I scroll, I want everything to scroll, including the image. What is the best approach for this:
a scrollview with an image view and a table view ?
create some kind of static cell in the tableview for the image?
Does anyone know some examples?
Any help is appreciated!
Best way is to use a UITableViewController. With that you can implement all the cells easily and efficiency. Then drag and drop an imageView on top of the tableView in the UITableViewController. You can place it right between the tableView and the Top to get what you want.

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)

Two UIViews & one UICollectionView inside UIScrollView (or better approach)

I need to have iOS app with screen like this:
screen
The idea is when user start to scroll down the first UIView to move up until the second UIView reach the top where it will stick and only UICollectionView will continue to move up.
Currently I'm using this structure
UIScrollView (main scroll)
UIView (some banners)
UIView (UISegmentedControl)
UICollectionView (grid with items, scroll is disabled, main scroll is used)
I manage to do it, but I needed to set UICollectionView height constraint manually in the code (calculated based on all items in grid) in order to appear in UIScrollView (everything else is handled by AutoLayout in Storyboard). The problem with this is that UICollectionView think all cells are visible and load them, so the whole recycling & reusing thing does not work. It's even worst because I use willDisplayCell method on UICollectionView to load more data when last cell is displayed, but now it load all pages at once.
My question (actually they are 2)
How can I fix the issue above?
What is the right way to achieve this functionality? Maybe my whole approach is conceptually wrong?
Collection view is a scroll view itself. So maybe you could have same functionality only with Collection view with sections or even custom layout?

How to have scrolling collection of uipageviewcontrollers

I currently have a UICollectionView that scrolls vertically and this is the perfect layout for my content, however now I need each element in that collection to be a flip through of pages just like the UIPageViewController. I can't seem to figure out how to combine these two types of views. The collectionview cell (if I understand correctly) cannot contain a viewcontroller. What would be an approach to achieve this?

Resources