• 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
Finding the 'best' size for a webView
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finding the 'best' size for a webView


  • Subject: Finding the 'best' size for a webView
  • From: "Mike O'Connor" <email@hidden>
  • Date: Fri, 19 Aug 2005 00:39:48 -0400

I just want to make sure there is no easy or even sort-of hard way to do this, cause it is turning out to be pretty complicated. The idea is to find the 'best' (as I'll call it) size for a WebView. You can see Safari doing it, for example. Load a page, and imagine starting with a huge window, then slowly resizing it to be smaller. At a particular width, a horizontal scroll bar will appear, and at a particular height, a vertical scroll bar will appear. By the 'best' size for the view, I mean the smallest size that won't produce scroll bars.

Of course, some web pages don't have a best width or height. Many pages like to be as wide or tall as you can get. But some definitely do have them. In my application, I have a webView, and I need to set it to the best size. In my case, there usually is a best size, because the HTML content I give it is usually a table with relatively small, fixed dimensions.

Since Safari (and any webView) seems to easily detect the width and height at which to turn on scroll bars, it is in fact doing the calculation I need. But there is no API to get at this easily. [I think there should be, because I believe this will be a problem more people will need a solution for as web views get more popular.] But is there a way to get at it at all, without parsing the HTML? Though my HTML is usually simple, it is user created and can be arbitrarily complex, and sometimes is.

I can get at the DOM tree of the view, and this might have some of the right info to compute it. But things look pretty complicated in there and the docs don't look extensive. Has anyone done work on this sort of problem?

_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Finding the 'best' size for a webView
      • From: "John C. Randolph" <email@hidden>
  • Prev by Date: Cross-nib bindings for to-many relationships
  • Next by Date: Re: Interface Builder vs Subversion
  • Previous by thread: Cross-nib bindings for to-many relationships
  • Next by thread: Re: Finding the 'best' size for a webView
  • Index(es):
    • Date
    • Thread