var storyboard = UIStoryboard(name: "Main", bundle: nil)
var viewController: UIViewController = storyboard.instantiateViewControllerWithIdentifier("view0000") as UIViewController
self.window?.rootViewController = viewController
self.window?.makeKeyAndVisible()
如何在UIWebView
appdelegate.swift
答案 0 :(得分:0)
在viewcontroller中为URL创建属性,并在AppDelegage中设置属性的值。然后在ViewConroller的viewDidLoad方法中,将URL属性值设置为UIWebView。
答案 1 :(得分:0)
var storyboard = UIStoryboard(name: "Main", bundle: nil)
var viewController: MyViewController = storyboard.instantiateViewControllerWithIdentifier("view0000") as MyViewController
viewController.url = "http://stackoverflow.com"
self.window?.rootViewController = viewController
self.window?.makeKeyAndVisible()
这将是你的MyViewController: 无论你想在reloadWebview
中做什么class MyViewController:UIViewController {
var url = "" {
didSet {
reloadWebView()
}
}
}