Scroll bar scrolls but UIScrollView doesn't scroll - ios

I have components in a UIScrollView. My scroll view works when it was in iOS 10 and Xcode 8 but after the update, my scroll view does not scroll. However, the scroll bar does scroll and can keep scrolling until it gets smaller and smaller. It is just the elements in the scroll view itself that doesn't scroll.
I have tried doing content size bigger than the frame size but it does not fix it. Here is my current views hierarchy.
If anyone can help me debug this, it would be greatly appreciated.

I fixed this by adding a content view to the scroll view, and then the scroll view should be the subview of main view. The hierarchy should look like this.

I encountered pretty much the same problem (scroll indicator moves and gets smaller but content doesn't move). In my case it was resolved by changing the AutoLayout constraint for the top of my content view within the UIScrollView. I had pinned it to the Frame Layout Guide rather than the top of the superview.

Related

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.

iOS 7.1 Why is my UIScrollView scrolling away on showing keyboard?

I have a UIScrollView designed with IB.
UIView
UIScrollView
UIView
UITextField
UIButton
...
If I tap on the text field the view scrolls away towards the upper left corner of the screen before the keyboard is appearing. The space above the keyboards remains empty. I can scroll back the view if I drag in this empty space.
I have googled around, but found only postings where users want to scroll UIScrollView. I want the view to stay where it is.
Thanks in advance for any suggestions.
Here's what happened.
You designed the whole thing in Interface Builder.
The scroll view was not scrolling, so you set its contentSize in code to the size of the scroll view's primary subview (what I like to call the content view).
The scroll view was still not scrolling, so you munged the content insets - and this caused the problem that brought you here.
Your mistake was (3). Instead, you should have thought more about (2), i.e., why isn't my scroll view scrolling even though I have given it a nice big content size?
The answer is that, in a storyboard or xib that has auto layout turned on, that's not what you do. What you do is use constraints from the content view to its superview (the scroll view), on all four sides. Set the constant for all four constraints to zero. This causes the content size to match the size of the content view, automatically.

Autolayout and embeded scroll views

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 ?

Horizontal ScrollView inside Vertical ScrollView

I have a UIScrollView that scrolls vertically. Inside of that, I have a UIScrollView that scrolls horizontally. I will call them verticalScrollView and horizontalScrollView.
My first problem was that verticalScrollView would scroll up and down, but the horizontalScrollView would not scroll at all. After turning off Autolayout and setting the content sizes in viewDidLoad, the verticalScrollView would always immediately scroll down the bottom upon appearing on screen and only be able to scroll up a little, but the horizontalScrollView (which is at the bottom) scrolls left and right perfectly.
I have tried almost everything that I have found online, but nothing seems to allow me to scroll vertically with the Main ScrollView (verticalScrollView) and scroll horizontally with the child horizontalScrollView.
I can post any more information that may be helpful. Thank you.
UPDATE (8-15-13): I put the hortizontalScrollView into a UIView, and put that UIView into the verticalScrollView. I am now able to scroll freely in the verticalScrollView, but can only scroll one swipe left or right in the horizontalScrollView before it snapping back.
In ViewController.m, I set the content sizes.
[_verticalScrollView setContentSize:CGSizeMake(320, 1905)];
[_horizontalScrollView setContentSize:CGSizeMake(960, 190)];
Please check your Autosizing is top-left or not? May be something wrong in size inspector view in XIB.
Hope this can be helpful to you.

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