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?
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.
Checking the Scale Page to Fit box in IB removed the border for me.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With