Skip to content

Commit c675fad

Browse files
committed
Center-aligned the snapshot view for portrait rotations with dynamic width pages.
1 parent 78da9cb commit c675fad

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

TOWebViewController/TOWebViewController.m

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1575,6 +1575,10 @@ - (void)animateWebViewRotationToOrientation:(UIInterfaceOrientation)toOrientatio
15751575
else
15761576
frame.origin.y -= (_webViewState.topEdgeInset - self.webView.scrollView.contentInset.top);
15771577
}
1578+
1579+
//ensure the image view stays horizontally aligned to the center when we rotate back to portrait
1580+
if (UIInterfaceOrientationIsPortrait(toOrientation))
1581+
frame.origin.x = floor(CGRectGetWidth(self.view.bounds) * 0.5f) - (CGRectGetWidth(self.webViewRotationSnapshot.frame) * 0.5f);
15781582
}
15791583

15801584

0 commit comments

Comments
 (0)