Search code examples
iphoneuiwebviewscale

UIWebView ScalePagesToFit on Some page?


I am working on a blog app, in which I parse the XML, and load the full article from the XML, and use loadHTML method on UIWebView to display. To get this to display properly, I have to set the scales pages to fit to NO. However, some of the blogs have links in the story, and when those are clicked, some of the pages need to be scaled. What do you recommend I do to get it to display all pages properly?


Solution

  • i think you'd be best served using the @protocol UIWebViewDelegate and implement the @optional webViewDidFinishLoad: .

    you can compare the UIWebView* property that exists to some known quantity to know if you've come back to your original blog page (or keep track of a stack that navigates away from your blog).

    you can probably examine the scrollView @property for frame size in making your decision about whether to set scalePagesToFit for that particular page.

    some of this you're going to have to calculate live and tweak as you see fit.