Autolayout and embeded scroll views - ios

I have a view that contains a scroll view and that scroll view has another 2 views in it: on top a standard view, and under that another view. This last view has a scroll view inside it. (a matroshka doll has nothing on this app) .
The problem is there is a button that causes the bottom view to resize and increase it's height, but the outer scroll view doesn't increase content size. So the bottom part of the bottom view (now resized to be bigger) is not visible.
Any suggestions on how to fix this mess ?

Related

Scroll Tableview Cell with outer Scrollview instead of It's own scroll ?

I have an Imageview covering half of the screen height and a tableview below it. Both are wrapped inside a UIScrollView. I want to scroll the whole view. Means inner scroll of tableview won't work and when I scroll, outer scroll will scroll image view up and then showing cells of tableview. At the end, Imageview will hide behind scroll and tableview content will take entire space. Can anybody tell me how to achieve this. ?
Thanks
I don't think you need the outer scroll view(UIScrollView). Why don't you add only the inner table view and image view to where your outer scrollview is added. The image view can be added either above or below the table view. Let say your image view is below the table view then your image view will be covered by table view. In order to make it fully visible, set the talbview's content inset top to imageview's height and its background to clear color. then you can see both image and table view contents without one covering the other. The last thing you need to do is you have to handle the image view's y position when you scroll the table view so it looks like they are in the same scroll view. Use the scroll view delegate that is already available to you and play with scroll view's content offset and image view's y position.
I answered some similar question here with some sample code. Hand off parent container's pan gesture to nested UICollectionView
It does with collection view but the main idea is same.

How to prevent a non-scrollable UIScrollView from stealing scroll event?

To elaborate on my question, I've three scrollviews one top of another, let say base, middle and top. Base scroll view's content size is more so it will scroll, middle scrollview's content size is equal to its frame so it will not scroll, top scrollview's content size is more than its frame so it will also scroll.
Now when I scroll the top scrollview, once it reaches its end, I"m expecting it would scroll the base scroll view as middle is not scrollable. But it seems middle scroll view consumes all my scroll events and not letting the scroll event to go to base scroll view.
I"ve tried by setting more content size to middle scrollview, then it working as expected, first top scroll view scrolls fully then it passes the scroll event to middle scroll view then to the base scroll view.
Now it is more evident that middle scrollview (which is non scrollable) is consuming all of my scrolling event from going to base scroll view. How do I prevent that.
Note : As I've to support zooming, I need scroll view in all three levels.
Any help would be really appreciated.
Thanks.

Page view constraints bug

I have set up a page view controller in swift with a scroll view and a view inside the scroll view. I made constraints for both of them but when I run the project on swiping left or right between the pages the view in the scroll view first comes a little bit smaller and then when the swipe is completed it expands.
Here is the problem:

UIScrollView that has UITableViews as subviews won't scroll horizontally

I have a view controller that owns a UISegmentedControl, a UIScrollView, and several UITableViews. The segmented control and the scroll view are subviews of the view controller's root view. The table views are subviews of the scroll view. The scroll view takes up all the space below the segmented control and each table view is as large as the scroll view. Table views are placed horizontally aligned inside the scroll view.
The view controller should support scrolling to one of its table views either by selection in the segmented control (that works) or by swipe gesture (that does not work yet). I have checked that the scroll view's contentSize is appropriate and I have also tried turning the table view cells' userInteractionEnabled off. I have also checked that the table views do not exceed the size of the scroll view as discussed here. (Each table view is as large as the scroll view, albeit at a horizontal offset.) Still the scroll view can|t be swiped horizontally as I would expect.
Could it be that the table views themselves consume all (including horizontal) swipe gestures as part of their support for vertical scrolling? How can I ensure that the scroll view further up in the scroll hierarchy can (also) react to such swipe gestures?

UIScrollview, other controls, not scrolling

I have an app which shows two images housed within a UIScrollview.
The scrollview is of size (320, 530), underneath it is an imageview size (320,38), this acts like a dock at the bottom of this screen, ( in fact it has to be there at the bottom of all screens in this app).
As it stand the scrollview works fine and the images switch from one to anothr when the user
moves the scrollview.
The problem is, I need the scrollview height to go all the way down ( from 530 to 568), and end up behind the dock imageview, when I change its height and the height of images within it, it just stops scrolling.
Is this impossible in scrollviews? does it have to have all of its screen real estate as top view?
Any solutions for this?
Thanks.
Update :
so I worked on the alpha and the image constraints, and the bottom imnage is located properly,
still the scrolling is not functioning.this is the latest code with changes.
http://ge.tt/4LYJGWl/v/0?c
thanks.
This is certainly possible. Add a full height scroll view to the controller's view, then add the small image view to the bottom. In the scene list at the left move that image view up so it's directly underneath the main view, which will make it a subview of that view rather than the scroll view (you'll then need to move the scroll view up above the image view so the image view will appear on top). You'll probably have to change some constraints to pin it to the bottom, and give it an alpha value less than 1 so the scroll view will show through.
After Edit
This is the screen shot of the scene from your updated code:
You only have one view that's directly under the main view, your scroll view. Compare that to my image.

Resources