How to layout correctly <p>I just try to create my own layout. I used <code>UITableView</code> for my <code>UIViewController</code>. I have some JSON response from server. This is like detailed publication. Also i calculate my <code>UITableViewCell</code> height because my publication contain mix of images and text. I wrote own layout and recalculate when device in rotation. </p> <pre><code>for (UIView * sub in contentSubviews) { if([sub isKindOfClass:[PaddingLabel class]]) { PaddingLabel *textPart = (PaddingLabel *)sub; reusableFrame = textPart.frame; reusableFrame.origin.y = partHeight; partHeight += textPart.frame.size.height; [textPart setFrame:reusableFrame]; } else if([sub isKindOfClass:[UIImageView class]]) { UIImageView * imagePart = (UIImageView *)sub; reusableFrame = imagePart.frame; reusableFrame.origin.y = partHeight; reusableFrame.origin.x = screenWidth/2 - imageSize.width/2; reusableFrame.size.width = imageSize.width; reusableFrame.size.height = imageSize.height; [imagePart setFrame:reusableFrame]; partHeight += imagePart.frame.size.height; } } </code></pre> <p>But I have some issue. When device change orientation state <code>UIScrollView</code> offset is same as was. I don't know how to change it. Before rotation:</p> <p><img src="https://i.stack.imgur.com/Is9aW.png" alt="enter image description here"></p> <p>After rotation:</p> <p><img src="https://i.stack.imgur.com/UiRf8.png" alt="enter image description here"></p> <p>I want to save visible elements in rect. Suggest pls.</p>