WebView and ioswebview for iOS development

Source: Internet
Author: User

WebView and ioswebview for iOS development

I have been using iOS apps for some time. I have never had the chance to use WebView in my previous demo. Today I will check for missing information and use WebView. The earliest contact with WebView was made in Android, And the WebView usage in iOS was quite simple. This blog does not have any advanced technology, but it only applies to webView. It can be seen from the literal meaning that WebView is used to load a webpage view, which is similar to a browser on a mobile phone.

1. previously, when I used the storyboard to drag controls, I just watched where the WebView was quietly lying down (as shown in) and never used it. If I wanted to use it, it would be easy to drag the web view Into the storyboard: today I will write a blog article to apply it:

 

2. Drag the WebView to the storyboard and associate it with the relevant Code as follows:

Code Description:

(1) Create an NSURLRequest

(2) Load NSURLRequest with myWebView

3. The webView delegate proxy mode is also quite simple, as shown below,

(1) shouldStartLoadWithRequest: called when a URL is requested

(2) webViewDidStartLoad: called after the webpage is loaded

(3). webViewDidFinishLoad: called after the webpage is loaded

(4). didFailLoadWithError: Call failed to load

 

4. The effect after successful loading is as follows:

 


How can I get the content size of uiwebview in ios development?

-(Void) webViewDidFinishLoad :( UIWebView *) webViewer {
CGFloat webViewHeight = [[webViewer stringByEvaluatingJavaScriptFromString: @ "document. height"] floatValue];
}
 
IOS developers know why the scrolling page cannot be achieved after the UIWebView is embedded in ScrollView?

To achieve horizontal sliding of scrollview, the frame of scrollview is required. size. width is smaller than the Contentsize of scrollview. width is irrelevant to the increase of UIWebview. You need to set the contentsize of scrollView. the width is greater than its frame. size. width.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.