Webview Tutorial Inward Ios Viii Alongside Swift

The UIWebView degree is purpose to embed spider web content inward an application. It tin flame survive done past times merely creating a UIWebView object together with attaching it to a window together with thus sending it a asking to charge spider web content.

Open Xcode together with practise a novel Single View Application. Fill out the Product Name, Organization Name together with Organization Identifier amongst your customary values. Enter Swift equally Language together with brand certain solely iPhone is selected inward Devices.




Go to the Storyboard together with On the bottom of the Interface Builder you’ll come across something that says “w Any”, “h Any”.  Change the width to compact together with summit to regular to change the persuasion to an iPhone inward portrait mode.



 Add a Web View to the primary view. The ViewController should expect similar this.


 Select the assistant editor together with opened upwardly the ViewController.swift file. Ctrl together with drag from the push to the degree department together with practise the next outlet.



We volition survive needing a belongings to concord the url of the spider web persuasion nosotros desire to show, thus add together a constant property. 

permit url = "https://developer.apple.com/swift/"


Next, modify the viewDidLoad to


    override func viewDidLoad() {         super.viewDidLoad()         // Do whatever additional setup afterwards loading the view, typically from a nib.                  permit requestURL = NSURL(string:url)         permit asking = NSURLRequest(URL: requestURL)         webView.loadRequest(request)     }  

And that's it. Build together with Run the projection together with hold off for a couples of minute together with you lot should survive able to persuasion the website displayed into the spider web view.
Next
Previous
Click here for Comments

0 komentar:

Please comment if there are any that need to be asked.