UIScrollView in UITableView Header not scrolling - ios

Following problem: I have a UITableView with several cells. The table has also a header, in which i added a UIScrollView, which should scroll horizontal.
So now when i scroll around the screen the table will always be scrolled, but not the UIScrollView in the header, even if i scroll horizontal in the area of the header.
So it seems the table is managing all the scrolling. How can i setup the UITableView scrolling so that the UIScrollView in the header handles the horizontal scrolling for the header area.
I tried to set delegate of the UIScrollView and tried the function from the UIScrollViewDelegate, - (void)scrollViewDidScroll:(UIScrollView *)scrollView, but only the table calls this function.
I hope you can help me.

Set content Size properly. Content size should be the width and height till where you want to scroll.
scrollView.contentSize=CGSizeMake(100,960);

Related

How to embed scrollview to tableview cell?

I have a scrollview embedded in a cell of tableview. The scrollview is a Foxit PDF rendering engine.
I want to scroll vertically the tableview, horizontally the scroll view. I couldn't. As on the first GIF you see scrollview is bouncing even the content height and scroll height is equal. But at least paging is possible.
Then I added a custom scrollview over the Foxit view into the cell. The bouncing disappeared and scrolling up and down the scrollview scrolls the table view. That is good. But now I can not horizontally scroll and change pages of the PDF.
What to do how to "merge" the two approach?
Try to play with panGestureRecognizer of scrollView and tableView. Install a relationship to prevent scrollView getting gestures before tableView scrollView.panGestureRecognizer.require(toFail: tableView.panGestureRecognizer).

Pass scroll between UIScrollView and embed UICollectionView

Here's my architecture.
I have a UIScrollView with some UIView's added in.
At the end on my scrollview i have a UICollectionView (embedded in my scrollview) in which i loads many data. I had to use a UICollectionView in order to reuse the multiple views displayed.
What i want is keep a smooth scroll when the user scrolls to the bottom of the parent scrollview and continue scrolling in the UICollectionView.
What i've made now is set the size of my UICollectionView equal to my UIScrollView Size and i've disabled bounces on both.
But i can't have a smooth scroll. When i reach the end of my UIScrollView, the scrollview's stop and then i have to re scroll on my UICollectionView
Not sure if it's really clear.
You should not normally "pass scroll" between elements. What you need to make sure is that the UICollectionView's frameSize is equal to its contentSize, meaning its frameSize expands as much as its contents so that all of its content is visible without having to scroll. Then your UIScrollView will handle the scroll and show the contents of your UIViewController by scrolling just itself.

Parallax header for tableview and uiview below the header

So i want to create a tableview which will be having a parallax header with an imageview inside the header and a uiview below the parallax header which will be fixed above the tableview, as if there is a uiview above the tableview.
--NavBar--
----Parallax header -----
----UIView------
---Tableview-cells----
Now the scrolling will become as this when i scroll down (for more cells).
--Navbar---
----UIView----
----TableviewCells scrolling---
Scrolling the tableview upward will decrease the header, as a parallax header should do, but the limit would be upto the uiview, after that the y of the tableview wont be decreased, and normal scrolling will commence(of course the tableview height will increase as the origin y decreases.)
Any idea how to achieve this? i got a sample code from cocoacontrols, but the desired effect comes as the tableview goes up, the uiview appears.
Here's the link to the sample code on github

AutoLayout. Stick UITableView to the bottom of UIScrollView

I need to achieve layout shown below. There are UIView and UITableView inside UIScrollView:
UITableView should be aligned right at the bottom of UIScrollView
UITableView should not have scrolling, so it's height should be adjusted according to content.
Row count is not static value.
Here are the constraints of UITableVIew:
If I understand AutoLayout correctly, everything should be fine, but as result I get UITableView's height to be 0. What's wrong with this setup?
I don't know what you are displaying above the UITableView but the normal setup for displaying something, that is above the tableView and scrolls with the tableview would be to use a UITableView (It is a Subview of UIScrollview and thus handles the scrolling itself) and add the things that you want to display above it as a tableHeaderView to your tableView.

UITableView dosen't change the size of UIScrollView when adding Cells

The scrollView, which is there with UITableView dose not change it's size.
So I have a UITableView, where Cells are added by the User. Right after adding these cells, I'm calling
[self.tableView reloadData];
Now the tableView shows the new cells added by the User. fine. But, if the tableView get's larger, if it's too big to show everything in the view, it doesen't change the size of my scrollView. I have no scrollView in the view, aside from the "normal" scrollView, which comes with the UITableView. So I can't scroll to the last row, because the scrollView is "too small".
Is there anything I forgot? I'm thinking of something like
[self.tableView.scrollView reload];
I'm using the same concept in another class: The user is able to add cells and they're shown. But in the other class the scrollView "resizes" correctly.
I assume that you have table inside a scrollview. You need to change content size of scrollview after adding cells. Height of content size should change according to content in scrollview so that you can scroll through whole content.
Updated answer:
I think your tableview's frame is larger. It is crossing window's bounds. Try minimizing tableview's height.

Resources