iOS Development--ui Article Swift &uiwebview

Source: Internet
Author: User

UIWebView

1     //return button Events2 @IBAction func backbuttonclick ()3     {4Self.navigationcontroller?. Popviewcontrolleranimated (true)5     }6     7     8     Overridefunc viewdidload () {9 super.viewdidload ()Ten          OneTitlelabel.text =titlestring A          -          -         //Do any additional setup after loading the view. the          -          -         //Create UIWebView -var Awebview:uiwebview = UIWebView (Frame:cgrectmake (0, $, Uiscreen.mainscreen (). Bounds.size.width, Uiscreen.mainscreen (). bounds.size.height- $)) +          -          +         //Add to view A Self.view.addSubview (Awebview) at          -         //URL string -var webstring ="http://www.iphonetrain.com" -          -         //initializing a Nsurl object with a string type -var url:nsurl! = Nsurl (string: webstring) in          -         //Initialize nsurlrequest with Nsurl object tovar request:nsurlrequest =nsurlrequest (Url:url) +          -         //webview loading Web pages the awebview.loadrequest (Request) *          $         Panax Notoginseng         //Set page compression, full-screen display -Awebview.scalespagetofit =true the          +          Avar htmlstring:string ="<font face= blackbody size=7 color=\ "red\" > Infinity Interconnect 3G College </font>" the          +         //BaseURL assigns a path to a resource CSS, using a network path to use CSS on the network - //awebview.loadhtmlstring (htmlstring, Baseurl:nil) $          $          -         //define a constant path -Let wordpath:string? = Nsbundle.mainbundle (). Pathforresource ("swiftintroduction", OfType:"docx") the      -         //initializing a Nsurl object with a string typeWuyiLet wordurl:nsurl! = Nsurl (string: wordpath!) the          -         //Initialize nsurlrequest with Nsurl object WuLet wordrequest:nsurlrequest =nsurlrequest (Url:wordurl) -          About         //Loading $ //awebview.loadrequest (wordrequest) -          -          -         //set up what the page view recognizes AAwebview.datadetectortypes =uidatadetectortypes.address +          the     } -  $     Overridefunc didreceivememorywarning () { the super.didreceivememorywarning () the         //Dispose of any resources the can be recreated. the     } the      -  in     /* the //MARK:-Navigation the  About //In a storyboard-based application, you'll often want to do a little preparation before navigation the override func Prepareforsegue (segue:uistoryboardsegue!, sender:anyobject!) { the //Get The new view controller using Segue.destinationviewcontroller. the //Pass The selected object to the new view controller. +     } -     */ the     Bayi     //MARK:-Uiwebviewdelegate the      theFunc WebView (Webview:uiwebview, Shouldstartloadwithrequest request:nsurlrequest, Navigationtype: Uiwebviewnavigationtype)Bool -     { -         ifNavigationtype = =uiwebviewnavigationtype.linkclicked the         { the              the         } the          -         return true the     } the      the func webviewdidstartload (Webview:uiwebview)94     { the         //Start loading the     } the     98 func webviewdidfinishload (Webview:uiwebview) About     { -         //Load completed successfully101     }102     103 func WebView (Webview:uiwebview, Didfailloadwitherror error:nserror)104     { the         //Load Failed106}

iOS Development--ui Article Swift &uiwebview

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.