Disable Horizontal Scrolling in UIWebView

Discussion in 'iOS Programming' started by nomar383, Mar 25, 2009.

  1. nomar383 macrumors 65816

    nomar383

    Joined:
    Jan 29, 2008
    Location:
    Rexburg, ID
    #1
    Okay, so I am writing an iPhone app that is basically one view (a UIWebView) that pulls down a bunch of text from my website. I have properly formatted the text on the server-side with CSS/HTML. However, I want to disable both horizontal scrolling, as well as the autorotation feature.

    When I add more text than the screen can hold, it disables horizontal scrolling for me automatically (only vertical is enabled at that point). When there is not enough text to fill the entire screen, then both horizontal and vertical scrolling are both turned on (that little "bounce" animation).

    I would like to disable the horizontal scrolling completely from the client side. Meaning the UITextView. Advice?
     
  2. jnic macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #2
    Code:
    <meta name="viewport" content="width=320, initial-scale=1.0" />
     
  3. nomar383 thread starter macrumors 65816

    nomar383

    Joined:
    Jan 29, 2008
    Location:
    Rexburg, ID
    #3
    This would go on the server-side in the main HTML file, correct? Thanks!
     
  4. nomar383 thread starter macrumors 65816

    nomar383

    Joined:
    Jan 29, 2008
    Location:
    Rexburg, ID
    #5
    How different is that from what I'm using right now? Will it do the job better?

    Code:
    <script Language="JavaScript">
    window.resizeTo(320,480)
    </script>
     
  5. nomar383 thread starter macrumors 65816

    nomar383

    Joined:
    Jan 29, 2008
    Location:
    Rexburg, ID
    #6
    Well I tried it, and it does the same thing as the script I had. The page still "bounces back" when you drag your finger left or right. Any other ideas?
     
  6. jnic macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #7
    No idea, try it out and post back your findings, would be interested if yours is a better way.

    Edit: Posted before I saw your last.
     
  7. jnic macrumors 6502a

    Joined:
    Oct 24, 2008
    Location:
    Cambridge
    #8
    You could overlay a view and only pass the vertical component of the touch to the web view.
     

Share This Page