UIWebView has a property called scalesPageToFit, which can be set to YES or NO.
I was wondering if anyone had an explanation as to what it actually does with regards to how it works. What criteria is it looking at when it scales the page? Is it looking for the widest table or div and then zooming out to fit that?
Thanks
So far to my knowledge when you set scalesPageToFit to YES it will show the content within the Webview space.
Then you can zoom out to see the content according to the users capability of reading.
I have done this a few times for pdf file, so it will show the pdf content within the content width. Actually it will scale it proportionally.
Related
I've got an information page which has about 3 pages worth of text to display.
What would be the best method to display all this text in an iOS application coded in swift?
I have been trying to do it with scroll view but I can't fit all the text into one label on one screen. And all the tutorials I'm following say to set the scroll view to the size of the label. But the thing is my text is so long that it would fill the screen several times.
How could this be accomplished so that no matter which device size screen it's being viewed on it will fit all my text and be scrollable vertically?
I can't seem to get it working with a scrollview :/
Put the content in an HTML file, and render it using WKWebView: https://developer.apple.com/library/ios/documentation/WebKit/Reference/WKWebView_Ref/index.html#//apple_ref/occ/cl/WKWebView
You can make a text view non editable.
I have this problem also.. Maybe you could use table view and add contents programmatically.. hope it could add to your imagination.
I have a UIWebView that displays a PDF. By default it opens the PDF and scales it to fit the entire width in the view, but not the height. I want it to fill the view so that the height stretches down to the bottom.
I have tried using contentModeScaleToFill, zoomToRect, and any other thing that sounded like it might have any relevance.
Can anybody help with this?
You might want to try #Jeff's suggestion and use CGAffineTransformScale to rescale your pdf after it is loaded to fill the screen. Look at his answer here: https://stackoverflow.com/a/3600665/188675
And to answer your question, 1) contentModeScaleToFill is a UIView Constant so it won't help with anything in your case, because you're using a UIWebView. 2) Using CFAffineTransformScale is much more simple and straightforward than using zoomToRect because you don't have to mess with the scrollView.
I am having a problem with UIWebView. My application displays pdfs from local memory and displays them in a webView in fullscreen mode. By default, when the page loads, the content is apparently set to fit horizontally, which cuts off some of the bottom of the pdf. I would like it to initially show up vertically fit and horizontally centered. I have looked for an answer to this question for quit some time and can't seem to find anything.
Any ideas?
(Please do not suggest scalesPageToFit. Although it fixes many beginning problems, this is not one of them.)
uiWebView.scrollView property has the ability to set zoom and also manage display of content
UIScollView class ref
I want to show a small preview of the current area being displayed of UIScrollView like Sublime text editor does.
Imagine that my UIScrollView size is 640x480, but the content is 640x960.
When I scroll I want to be able to show a small preview of the whole UIScrollView content in the top right corner, making possible for the user to understand which part of the UIScrollView he is actually looking at.
How do I achieve such thing?
CAReplicator?
CAScrollLayer?
I'm kind of lost here so any tips would be awesome.
Thanks,
With my best regards,
Nuno
A noob here so it might take a while to understand what's the wrong, just follow along ..
the key purpose of my app is to download an xml file from rss feed then parse it and pass it as html file to a webview with this method: [webView loadHTMLString:aString baseURL:nil]
after the content took place in the webview it doesn't fit nice and neat instead there's some photos in the content that has a width larget than what it can be displayed at once without scrolling horizontally,as well as the attachments at the end of the webview you have to scroll a bit right or left to read the full name of it, it'd be nice if the content stretched so it can be seen without scrolling horizontally.
Notice that I adjusted webview property scalesPageToFit to be YES, but that scaled the content to very small size to the point that you can't read what it contains!
any solution around this?
You need to use a meta/viewport tag and se the content width. See documentation, here:
https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/MetaTags.html