I am creating a magazine app. I am displaying each page of my magazine in a UIWebView. The webview doesn't fill the screen with the PDF though. There is a border around it. How can I display it fullscreen?
+1
A:
I have not tried this with a UIWebView, but you may be able to do something like this to programatically position the border so that it's offscreen:
CGRect frame = webView.frame;
// you may need to modify the 5 and 10 below to match the size of the PDF border
frame.origin.x = frame.origin.x - 5;
frame.origin.y = frame.origin.y - 5;
frame.size.width = frame.size.width + 10;
frame.size.height = frame.size.height + 10;
webView.frame = frame;
If you are using the UIWebView to display PDFs and HTML, you would of course only modify the frame when displaying a PDF, and then set the frame back to the original values when displaying other content.
I have done this type of thing with a UIScrollView for a different reason: to provide padding around the items displayed in the UIScrollView so that there would be a gap in scrolling (as demonstrated in Apple's PhotoScroller example from WWDC 2010). I'm guessing that this could also work to move the borders around the PDF off of the screen.
GregInYEG
2010-09-17 03:54:41
Great workaround! Thanks so much for this!
John
2010-09-17 11:34:46