Note that there are some explanatory texts on larger screens.

plurals
  1. POResizing UIView with UIScrollView subview
    text
    copied!<p>hey guys! i have a big problem concerning the resizing of a derived <code>UIView</code> with a <code>UIScrollView</code> as subview.</p> <p>in the <code>layoutSubviews</code> message i set the frame of the UIScrollView subview. the <code>UIScrollView</code> contains a <code>UIImageView</code> with a big image which can be moved/pinched and so on. the initial <code>contenSize</code> of the <code>UIScrollView</code> is the initial image size.</p> <p>so far, so good. moving and pinching of the image works well. now i have to change the UIView frame (in my app to maximize the UIView). im doing that in a animation block (<code>beginAnimations</code>/<code>commitAnimations</code>). so i set the new frame (which will update the width &amp; height) an then i call <code>[myView layoutIfNeeded]</code> to force the UIScrollView to update its frame in the <code>layoutSubviews</code> message of my view.</p> <p>the <code>UIView</code> animates correct to its new frame and if the <code>contentOffset</code> of the <code>UIScrollView</code> is currently <code>x 0, y 0</code> the <code>UIScrollView</code> frame will be updated properly. but here's my problem: if the <code>contentOffset</code> of the <code>UIScrollView</code> is <strong>bigger than</strong> <code>x 0, y 0</code> the <code>UIScrollView</code> will "slide in" from upper left to its final position.</p> <p>i want that the UIScrollView resizes its frame properly with the parents frame and aligns the content (in my case the <code>UIImageView</code>) right. but how could i achieve that?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload