UITableView not scrolling inside of UIScrollView - uitableview

in my view controller I have a ScrollView for content adaptation on various devices .. I need to insert a tableView inside the ScrollView but I noticed that my tableView not scrolling when it is inside a ScrollView. Can someone help me figure out how to fix this?

If you want your table view to scroll set the content size of scroll view less than that of your table view.

Related

UICollectionView Scrolling the ViewController

Im trying to implement a CollectionView inside my viewController.
And it works just fine.
The problem Im having is that the CollectionView scrolls inside the Parent controller.
I wish to make that if you scroll the collection view - the whole view is scrolled and not just the collection view bit.
I tried disabling scrolling on the Collection View but then nothing is scrolling anymore.
So how would I go about setting the collection view, so that once you scroll on it the whole page scrolls and not just the collection view scrolling inside the parent view controller?
It should be simple, and you've done one right thing already.
Disable scrolling of your collectionView (or tableView, in the future just in case you'll use it, they're basically the same).
Add your collectionView (or tableView) inside a scrollView.
That scrollView is of course in your controller's view.
Make sure every constraints are set properly.
You might need to get the size of your collectionView (say height), and set that height value to the constraint height of your collectionView.
These answers of mine in the past should help you:
https://stackoverflow.com/a/52657995/3231194
https://stackoverflow.com/a/54211275/3231194
https://stackoverflow.com/a/53971539/3231194
Voila. The only scrolling enabled is your scrollView that contains your collectionView (or tableView).

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

UITableView Footer is not showing

enter image description here The Controller is UIViewController.
I have a UIScrollView in UIViewController. A Tableview is added as a subview upon the scrollview. The Scroll view content size is bigger than the screen size. There is a footer in the Tableview. When I am reloading the Tableview first time with the data then the Footer is not displaying but when I started the scroll then the footer is not displaying properly.
Could you please guide me, how to make this resolve.
Thanks
Firstly, it's wrong practise to add UItableview inside scrollview, because tableview already has scrollview underneath it and will adjust the content size of tableview automatically depending on the content you add.
Can you please let me know the reason why you have added tableview inside scrollview?
Remove tableview from scorllview and everything show work fine.

UITableview frame changes after scrolling thanks to Autolayout

I'm working on a application where I have a UITableView inside a UIScrollview.
The TableView will display current games players are in, its inside a UIScrollView. I dynamically add cells to the UITableView for each game, but when I scroll the UIScrollView, the tableview inside it snaps back to its size set in the storybuilder.
This is because of autolayout, when I disable it, it doesn't happen anymore. However I do like autolayout for other views in my app. So my question is, how can I fix this problem?
Maybe someone can help me get on the right track.
Thanks
EDIT
I think I must explain my situation more, I will use an image where I can display what is happening
Explanation
Before and after scrolling.
As you can see I use the scrollview because there can be many games, so you'll have to scroll down to see them all. The TableView is just to hold the data, scrolling is disabled on that. After scrolling the TableView that says "JOUW BEURT" snaps back to its size set in the Storybuilder. This is because of auto layout like I said, but I don't know how to fix this.
You shouldn't put a tableview inside a scrollview as a tableview itself contains a scrollview and causes issues just like you are seeing when you have a scrollview inside a scrollview.
Remove the scrollview and this should fix your issue. If you are wanting to put content above the tableview or where you scroll down to view the tableview cells etc, consider adding a tableview header view that is added above the tableview.
Why did you place UITableView inside UIScrollView?
Check below
Check your constraints of UITableView and UIScrollView
Placing UITableView inside UIScrollView is somewhat strange
EDIT
You will just need to remove the scrollview and enable scrolling feature of the tableview. that will fix it
UITableView is already a subclass of
UIScrollView

ios : tableview not appearing in subview of a scrollview

I have a scrollview with multiple views.Enabled horizontal scrolling.Each view contains a tableview.I have page control in scrollview. when i drag horizontally, the views are appearing without tableview except the first view. Please give me suggestions.
Make sure if setContentSize to your scrollview means scrollview content size is the size of your main view.
When you scroll to next view or if you scroll to view displayed for first time, make sure you reload table. You can implement his through delegate and protocols. For example, when you scroll to second view for first time, then controller should call some method on subview to reload its table.

Resources