Webpage does not have the correct size in my UIWebView - iphone

When i load a specific URL in Safari, the page is shown correctly...means small and the whole page fits the screen, so that i dont have to scroll horizontal.
When i load the same URL in my UIWebView, the Webpage appears very large. So if it appears on a desktop PC. How can i solve this problem? Why des it appear so large and in Safari on iPhone all is ok?
I use this line of code to load the page
[self.newsWebView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:#"<URL GOES HERE>"]]];
Thanks,
Chris

You need to set the scaleToFit property of the UIWebView to YES. You can do that in code or use the interface builder (there's a scaleToFit tick box for the WebView).

Related

Display a specific Layout in UIWebView

is there any way to display a specific layout of a website in UIWebView? for example in www.google.com. can we display only Google image in UIWebView rather than showing all content of the page like search bar , search button.. etc..
No It is not possible. When you call www.google.com on UIWebView you are displaying web page in your app. And you don't have any control on the content.

Ways of showing a webpage in iPhone?

I have a UIwebview which loads up a page ,first the links in the page were opening up on the same page, that made it look ugly, then I found a function which made the link open up in the phone's safari browser.That was nice but actually I want to show the links in a pop up view which can simply be closed. I have seen the google map popping up and showing the map. I want to do the same same thing with the links on the page they should open up as pop up and should not open up in safari and neither in the same UIWebview.
What could be the possible way to implement this.
Another inspiration is phonegap's ChildBrowser which opens the link as a popup.
I want to implement the same in native.
Any help and suggestions will be appreciated.
You have to use UIWebview to show the web content for the link. just resize it by using frame property as per your requirement because it's inherited by UIView.

fitting the webview page in iPhone without scroll depending upon the data present in a html file

can any one help me..am doing one webview application in iPhone. I am very new to this is technology...my requirement is when am displaying the html content into the webview page depending upon the data the webview page has to fit that means no scrolling comes the page should fix.
Try this Code :
self.myWebView.scalesPageToFit = YES;

UIWebView in iphone4.0

I use UIWebView in iphone4.0 show a html page,but can show one page and cannot scroll. after rotate iphone It can show all page and scroll normally ,this problem is not exist in 3.1
I find this is a html page peoblem,and I modify the html,it's good !I think iphone4.0 UIWebView core is updated!

UIWebView not showing the wikipedia search bar

I am using UIWebView to provide a simple browser in an app. When I go to Wikipedia the search bar at top of the page (mobile version) is never shown in the UIWebView. Scrolling down and back up does not make it visible.
I tried both cases (YES/NO) for scalesPageToFit but did not do anything.
The problem is that Wikipedia is reading the user agent string and deciding not to show the search bar. (UIWebView's user agent is slightly different than mobile Safari's user agent.) Unfortunately, it looks like you cannot change the user agent string used by UIWebView.