UIScrollView Interaction Area does not update with frame/contentSize

I have a UIScrollView which starts with a portrait aspect and which I subsequently (after device rotation) move to another frame which is a landscape aspect.

Accordingly the content view (A UIView inside the UIScrollView) is updated and I set the contentSize of the UIScrollview.

The issue is - after rotation - the UIScrollView has a new frame, new content and new contentSize but the area inside which the user can swipe still behaves as if it was the original frame/content.

Image 1 shows the original aspect / Image 2 shows the new aspect with the odd area available to the user for their swipe gestures.

As you might expect I've fiddled with quite a few of the settings in the scroll view such as the bounds etc but nothing to date has 'fixed' this behaviour.

Any insights into why this behaviour is happening and/or how to set the user interaction area to the frame/bounds of the scroll view would be greatly appreciated.

EDIT2:

There are 3 views in this hierarchy Lanscape mainView Frame {0,0,1024,748} resultsView Frame {633,90,361,677} scrollView Frame {20,60,340,595}

Portrait mainView Frame {0,0,532,1240} <--- Whoa Horsy - I expected .... {0,0,768,1004} resultsView Frame {0,659,768,345} scrollView Frame {0,70,768,280}

At this point I went into every nib in the project and made sure that autoresizes was turned off and I also tagged every view with a different number so that at the time I was checking the frames I could be sure certain definite positive of what I was looking at.

The top level view in the stack WAS autoresizing and now with that turned off I am getting this for the portrait result..

mainView Frame {0,0,768,1004} ..... YES! WIN..... resultsView Frame {0,659,768,345} scrollView Frame {0,70,768,280}

EDIT1:

Setting the resizing mask as comments below reduces the visible size of the scrollview to match the interaction area - so making it seem that the scrollview really does think it's frame is that size only (768 made to look like 468 or so). Increasing the width of the frame does indeed increase the size of the scroll view but there are only 768 pixels for the full width so why should a frame thats 768 wide look like 468 and a frame of 686 look like 568?!

Answers


It sounds like you've got a superview of your scroll view which isn't resizing correctly. You could verify this by logging [myScrollView superview] and seeing if that view is resizing as you expect.

If the superview is not resizing, then it won't pass touches down to your scrollview, which explains the behaviour you're seeing. (This also explains why it resizes when you set is autoresizing mask.)


Need Your Help

Recording video in C# and WPF from mediaElement

c# wpf video record mediaelement

My application applies custom HLSL shader effects to a mediaElement using decorators. How can I record and save the modified video using the application itself in realtime?

Twitter Integration in Blackberry: Login Page not in English

blackberry twitter browserfield

I am trying to integrate twitter using Twitter Api me 1.8 . When i try to authorize using OAuth the login Screen look like below .Some invalid charecters are showing.please help me to identify the