带有请求URL的WebView Swift

时间:2015-04-08 13:38:46

标签: ios swift webview

我有一个应用程序连接到URL,进行搜索,并返回自己的URL中的数据,我怀疑的是你是否可以使用webview只显示结果,即..它连接和做研究,webview显示结果,有可能吗?我会发布代码。

@IBAction func btnCon(sender: UIButton) {

    var storyboard = UIStoryboard(name: "Main", bundle: nil)
    var controller = storyboard.instantiateViewControllerWithIdentifier("Resultado") as UIViewController

    self.presentViewController(controller, animated: true, completion: nil)



    let myUrl = NSURL(string: "MY URL")


    let request = NSMutableURLRequest(URL:myUrl!);
    request.HTTPMethod = "POST";

    // Compose a query string
    let postString = "nome=\(cmdDig.text)&aliquota=19";

    request.HTTPBody = postString.dataUsingEncoding(NSUTF8StringEncoding);

    let task = NSURLSession.sharedSession().dataTaskWithRequest(request) {
        data, response, error in

        if error != nil
        {
            println("error=\(error)")
            return
        }


    // Here I use a println to show result in String, but its possible show webview with the search result on the website?

    }

0 个答案:

没有答案