私はwebviewを起動するボタンでアプリケーションを作ろうとしています。Xcode別のViewControllerでWebViewを開く
私は多くのチュートリアルに続き、主題について貴様のトピックを読んで私はそれが動作しますカントました:私は自分のコードをテストするとき、私はこのメッセージを取得しています:
"Cannot call value of non-function type UIWebView!"
ここで私が今までやった手順です別のビューコントローラを作成する主ビューコントローラ
- 「WebViewController」
- にセグエを追加「myWebView」
という名前WebViewControllerのViewControllerでのWebViewを追加WebViewControllerクラス
import UIKit
class WebViewController: UIViewController{
@IBOutlet weak var myWebView: UIWebView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view.
//define url
let url = NSURL (string: "http://www.my-url.com")
//request
let req = NSURLRequest(url: url as! URL)
//load request into the webview
myWebview(req as URLRequest) //error happens here :
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
/*
// MARK: - Navigation
// In a storyboard-based application, you will often want to do a little preparation before navigation
override func prepare(for segue: UIStoryboardSegue, sender: Any?) {
// Get the new view controller using segue.destinationViewController.
// Pass the selected object to the new view controller.
}
*/
}
ここでは、スクリーンショット(pictur eは長文以上のテキスト、右=)
ありがとう!
これを一度ご覧ください。http://stackoverflow.com/questions/39682344/swift-3-webview –
Thanks @ Anbu.Karthik!その作業!私は理由を知っていませんが、間違いなく働いています! – skytorner