UIWebView autorotate shifts content

Discussion in 'iOS Programming' started by nazgul42, Apr 12, 2009.

  1. nazgul42 macrumors newbie

    Aug 1, 2008
    I have a UIWebView set up that autorotates as I expect it to. The only thing is that when I rotate from portrait to landscape, the content of the UIWebView is scrolled up a couple of screens if it is a small page, or a large amount if the view is displaying a large page. When I rotate the app back to portrait view, the content scrolls back to where it is supposed to go. If I set the UIWebView's scalesPageToFit property to no, it does not do this, but then I cannot resize the content, which is undesirable. How can I make it so this does not scroll? Thanks you
  2. PhoneyDeveloper macrumors 68040


    Sep 2, 2008
    Try adding this

    - (void)didRotateFromInterfaceOrientation:(UIInterfaceOrientation)fromInterfaceOrientation
    	[myWebView reload];
  3. nazgul42 thread starter macrumors newbie

    Aug 1, 2008
    Thank you for your reply, but I did something different.
    I have the web view store where it is scrolled to before it rotates, and .2 seconds after it rotates, I have it reload that scroll position. That works for me.

Share This Page