lundi 25 juillet 2016

Is it possible to use a function similar to webViewFinishLoad without delegating?

I'm creating a framework to manipulate PDFs and at once point I load PDFs using the following code:

@IBOutlet var webView1: UIWebView!

override func viewDidLoad() {
    super.viewDidLoad()

    if let pdf = NSBundle.mainBundle().URLForResource("template", withExtension: "pdf", subdirectory: nil, localization: nil)  {
        let req = NSURLRequest(URL: pdf)
        webView1.delegate = self
        self.webView1.loadRequest(req)
    }

}

And then making use of the UIWebViewDelegate properties of my ViewController class to benefit from webViewFinishLoad to know when loading is finished.

Is there anyway of achieving this same end result without delegating my webView1 to main view?

Aucun commentaire:

Enregistrer un commentaire