Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3959230
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T02:42:16+00:00 2026-05-20T02:42:16+00:00

I created a bare bones iPhone app with a UIWebView (Scales Page to Fit

  • 0

I created a bare bones iPhone app with a UIWebView (Scales Page to Fit = YES, shouldAutorotateToInterfaceOrientation = YES) and loaded a webpage, e.g. https://stackoverflow.com/

Rotating the device shows that UIWebView is auto-resized to fit the width. Good.

Incorrect: Zoom into the page and zoom out. Now rotating the device shows UIWebView in a weird width in one of the orientation (if u zoom in landscape, the portrait width is weird, vice versa). This behavior is fixed only when you navigate to another page.

Correct: Load the same URL in Mobile Safari. Rotating works & the width fits regardless of the zooming exercise.

Is this a UIWebView bug (probably not)? Or is there something that needs to be done to make things “just work” like in Mobile Safari?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-20T02:42:17+00:00Added an answer on May 20, 2026 at 2:42 am

    I found something that worked for me. The problem is that when uiwebview changes its orientation web contents are zoommed to fit with viewport. But zoomscale parameter of scrollview subview is not updated correctly (nor are updated minimumZoomScale nor maximumZoomScale

    Then we need to do it manually at willRotateToInterfaceOrientation:

    - (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
        CGFloat ratioAspect = webview.bounds.size.width/webview.bounds.size.height;
        switch (toInterfaceOrientation) {
            case UIInterfaceOrientationPortraitUpsideDown:
            case UIInterfaceOrientationPortrait:
                // Going to Portrait mode
                for (UIScrollView *scroll in [webview subviews]) { //we get the scrollview 
                    // Make sure it really is a scroll view and reset the zoom scale.
                    if ([scroll respondsToSelector:@selector(setZoomScale:)]){
                        scroll.minimumZoomScale = scroll.minimumZoomScale/ratioAspect;
                        scroll.maximumZoomScale = scroll.maximumZoomScale/ratioAspect;
                        [scroll setZoomScale:(scroll.zoomScale/ratioAspect) animated:YES];
                    }
                }
                break;
            default:
                // Going to Landscape mode
                for (UIScrollView *scroll in [webview subviews]) { //we get the scrollview 
                    // Make sure it really is a scroll view and reset the zoom scale.
                    if ([scroll respondsToSelector:@selector(setZoomScale:)]){
                        scroll.minimumZoomScale = scroll.minimumZoomScale *ratioAspect;
                        scroll.maximumZoomScale = scroll.maximumZoomScale *ratioAspect;
                        [scroll setZoomScale:(scroll.zoomScale*ratioAspect) animated:YES];
                    }
                }
                break;
        }
    }
    

    Hope this helps!

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm attempting to create a bare bones app for use in developing a plugin.
I've created a bare bones Master/Detail iPad application using the supplied template. It creates
I was following the steps here: http://matt.might.net/articles/how-to-native-iphone-ipad-apps-in-javascript/ Here are the bare bones steps to
I obviously don't get this somewhere. I have created a UserControl, the bare bones
I have created a bare git repo (lets call it repo #1) and cloned
I've created a bare git repository (Core), cloned from a pre-existing repo (Production) using
I could really use some help here. I just created a new bare repo
I'm currently working on trying to create a very basic bare bones instant messenger
I have created an HTML page which uses simple CSS (no javascript) for menu
I just created a web page having a barebone chart with a few data

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.