• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: scrolling content view resizes visibly but bounds and frame don't change
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: scrolling content view resizes visibly but bounds and frame don't change


  • Subject: Re: scrolling content view resizes visibly but bounds and frame don't change
  • From: Christopher Corbell <email@hidden>
  • Date: Sat, 11 Sep 2010 14:34:14 -0700

On Thu, Sep 9, 2010 at 1:24 AM, Quincey Morris
<email@hidden>wrote:

> On Sep 9, 2010, at 00:20, Christopher Corbell wrote:
>
> > This one is really bugging me.  I have a WebView in a scrolling view and
> > content gets appended to it periodically (new tables appended; the entire
> > content of the WebView is reset each time via loadHTMLString on the
> > mainFrame).
>
> You don't want to put the WebView inside a scroll view because it handles
> its own scrolling. Take a look at:
>
>        http://www.cocoadev.com/index.pl?HowDoIScrollAWebView
>
> (which was the first hit I got googling "webview scrollview"). I think it
> has the solution to your problem. (But read all the way to the end. The
> first couple of suggestions seem to be flubs.)
>

Thanks for the link - actually the WebView seems to work in a scrollView if
you put it there in InterfaceBuilder but I see now that you don't need to,
so I have revised the WebView to be on its own and it indeed shows its own
scrollbars when needed.  I also followed the tip about the async load, i.e.
don't adjust your scrollbars until the frame finishes loading.

However the basic issue still remains - even with the scrollView that the
webView implements automagically, its contentView bounds do NOT change even
when the visual content is clearly larger than the frame and the vertical
scroller is present and adjusted properly.

FWIW here is some of my changed code, and the resulting logging - this now
only gets called after load of the frame completes:

    NSView * frameView = [[webView mainFrame] frameView];
    NSScrollView * scrollView = [frameView enclosingScrollView];

    NSRect fvFrame = [frameView frame];
    NSRect fvBounds = [frameView bounds];
    NSRect docFrame = [[scrollView documentView] frame];
    NSRect docBounds = [[scrollView documentView] bounds];
    NSRect webFrame = [webView frame];
    NSRect webBounds = [webView bounds];
    NSRect contentFrame = [[scrollView contentView] frame];
    NSRect contentBounds = [[scrollView contentView] bounds];

Logging output:

fvFrame: (0,0) 315 x 395
fvBounds: (0,0) 315 x 395
docFrame: (0,0) 315 x 395
docBounds: (0,0) 315 x 395
webFrame: (7,161) 315 x 395
webBounds: (0,0) 315 x 395
contentFrame: (0,0) 315 x 395
contentBounds: (0,0) 315 x 395

Surely someone has encountered this and can say why the bounds aren't
increasing with the logical size of the content?  How does the scrollView
even know how to update itself properly without this?

TIA,
Chris
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: scrolling content view resizes visibly but bounds and frame don't change
      • From: Quincey Morris <email@hidden>
References: 
 >scrolling content view resizes visibly but bounds and frame don't change (From: Christopher Corbell <email@hidden>)
 >Re: scrolling content view resizes visibly but bounds and frame don't change (From: Quincey Morris <email@hidden>)

  • Prev by Date: Re: Inactive Window Receives Mouse Events
  • Next by Date: Re: scrolling content view resizes visibly but bounds and frame don't change
  • Previous by thread: Re: scrolling content view resizes visibly but bounds and frame don't change
  • Next by thread: Re: scrolling content view resizes visibly but bounds and frame don't change
  • Index(es):
    • Date
    • Thread