One Horizontal and one vertical UICollectionView placed within a UIScrollView iOS Swift - ios

I have two collection views within a scrollview. The above collectionview is a horizontal collectionview and the bottom one is a vertical. I am fetching all the data from api. And when I'm reaching at the bottom of the vertical collection view I need to hit a new api to fetch the new data. I am able to do that with the method willDisplayCell, but with that the problem I'm facing is UIScrollView. I can't scroll properly on my device. The bottom UICollectionView can not be scrolled smoothly. Can anyone suggest me something? Thank you

Do not put your collectionView in scrollView. Instead of doing so, put your horizontal collectionView as headerView in vertical collectionView.

Related

How to make a Horizontal and vertical scrolling TableView in iOS using storyboard?

here is my design structure
I was wondering about creating a horizontal and vertical scrolling tableview. I have tried a tableview inside a scrollview but I failed miserably. What to do?
I use swift4 but I wanted to do in storyboard.
The nature of content is like an excel sheet with lots of horizontal and vertical scrolling rows and columns of data.
Actually you can do this using a hack. Put the tableView inside a scrollView. Then you should give a dynamic width to the tableView by specifying a width in storyboard for tableView or any child view of that scrollView(So we get the horizontal scrolling).You have to adjust some constraints depending on your requirement
Mine worked fine but as many users have said try a collection View if its easy
Note. There is a default scrollView within a tableView, So adjust your height of tableView in a way so the scrollView of tableView work and not the parent scrollView, while scrolling from top to bottom
Instead of using TableView try using collection view, there you can use horizontal and vertical scrolling using storyboard?
Try to use collectionview instead of tableview.
If your requirement demands use of tableview anyhow, then you can use tableview within scrollview.
In tableview within scrollview approach, you need to distinguish your parent scrollview as well as tableview's scrollview. Try to differentiate parent scrollview and tableview's scrollview with different tags. Because both scrollview will call delegate methods of viewcontroller, if implemented. Just check tag of scrollview in all delegate methods of scrollview and perform action accordingly.
As per my understaing you want a view which you want vertical scroll view and horizontal inside it.
So here my suggestion is to use UITABLEVIEW for vertical scrolling and UICOLLECTIONVIEW for horizontal scrolling inside tableview
Both will work fine

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 items flow direction vertical and scroll with horizontal direction

i have UICollectionView, i need Horizontal scroll direction and Vertical items flow. It's possible with native instruments?
You can have a parent UICollectionView scrolling vertically & each section or row can contain child CollectionViews scrolling vertically.
To maintain sanity, do setup your dataSource's for parent & child's independent of each other.
You should be able to utilise same handler for all child collectionViews.
You have add UITableView inside that tableviewcell add the UICollectionView and also set the UICollectionView Scroll Direction is Horizontal.

Horizontal UICollectionView with Header on Top

I'm kind of stuck with a problem here. I need to create a horizontal scroll Collection View, but when I select to add its header, xcode sticks it on the left side of the cells and I need it to be above the cells, as on the vertical scroll.
Any tips?
embed UICollectionViews in a UITableView like so:

Mixing UIScrollViews and UITableViews

If you look at the Featured tab of the Apple App Store app on an iPhone 6, there is a unique UI layout that I can't figure out how to replicate.
At the very top there is a navigationBar. Below this there is a UIScrollView that animates through a number of featured items. Below this is what appears to be a UITableView with a number of custom programmed cells.
My first guess was that the UIScrollView at the top was added to a custom cell at the top of a UITableView. If you swipe up the UIScrollView moves with the objects below like it is a cell. You can see that the vertical scroll indicator starts at the top of the UIScrollView.
The part that is unique is that if you swipe down, the objects below the UIScrollView move down like a UITableView and the UIScrollView stays in place. This means that the UIScrollView is not a custom cell at the top of a UITableView.
I tried making this work a number of different ways but I can replicate this. Does anyone know how this can be done?
You can use a tableview header,the header is a scrollview
If you scroll tableview up,just use tableview default behavior,the header will scroll up.
If you scroll down,use UIScrollViewDelegate to calculate the tableview header new frame,and adjust it.So it remain at top
Not sure if I got you correctly, you may use UICollectionView as vertical scroll. Then, you create a custom UICollectionViewCell, each with horizontal scroll.
I haven't tried it though but done something similar to this. Hope you find a way!

Resources