I am trying to get a UIScrollView on an iPad to work. I have looked at nearly all existing questions but none have really solved my problem. So basically here is my code upfront:
[scroll setScrollEnabled:YES];
scroll.contentSize = CGSizeMake(scroll.frame.size.width, 2320);
Called in viewDidLoad by the way. When I build and run, the scroll views side bar changes its position when I scroll (indicating that it is working) but the view does not change/remains at the top. My view consists of many UIImageView‘s, but I do not think that is a problem. Also for my arrangement, my scroll view is at the front of the whole view.
Thank you!
UPDATE:
So basically what is happening is my UIView‘s scroll view does not cover the WHOLE view. It does not cover the most top part where I have a label and a button. But however, when I load it to the iPad, my images are covering the top…. making it now possible to scroll up and down.
Why is this happening?
Screenshot:

UPDATED:
My code:
[scroll setScrollEnabled:YES];
scroll.contentSize = CGSizeMake(scroll.frame.size.width, 1500);
[scroll addSubview: i1];
[scroll addSubview: i2];
[scroll addSubview: i3];
[scroll addSubview: i4];
[scroll addSubview: i5];
[scroll addSubview: i6];
[scroll addSubview: i7];
[scroll addSubview: i8];
[scroll addSubview: line];
Any idea as to why this is happening?
Is adding a subview to the scroll view even correct?
UPDATE:
I have another problem, I have implemented the touchesBegan method and if the user touches any of those images, a pop up containing certain information is shown. That code is pretty standard though, don’t need to show it. So, is there a way for a scroll view to respond to touches for its content?
The problem is that whenever I touch the image, touchesBegan is never called because the scroll view is in front, right? But if I send the scroll view backward scrolling does not work.
I have many problems here as you can see, but instead of looking at my code and trying to solve each mistake. I had a better idea. Here is what I am trying to do:
Have a scroll view on an iPad which scrolls through a timeline which is technically multiple images. These images are touchable. And the scroll view only takes a portion of the screen, the top part is a back button and label which should not scroll. How can I do this?
Make sure you set the frames for your subviews properly. If not, your subview will most likely default to a (0,0) position in the scrollview.