我在 IOS 应用程序中使用 WKWebView,并且设法使活动指示器出现在状态栏的左上角。如何将其显示在屏幕中间?
这是我正在使用的以下代码:
@IBOutlet var containerView : UIView! = nil
var webView: WKWebView?
override func loadView() {
super.loadView()
self.webView = WKWebView()
self.view = self.webView!
}
override func viewDidLoad() {
super.viewDidLoad()
let url = NSURL(string:"https://www.example_link.com/")
let req = NSURLRequest(URL:url!)
self.webView!.loadRequest(req)
webView!.navigationDelegate = self
}
override func didReceiveMemoryWarning() {
super.didReceiveMemoryWarning()
// Dispose of any resources that can be recreated.
}
func webView(webView: WKWebView, didStartProvisionalNavigation navigation: WKNavigation!) {
UIApplication.sharedApplication().networkActivityIndicatorVisible = true
}
func webView(webView: WKWebView, didFinishNavigation navigation: WKNavigation!) {
UIApplication.sharedApplication().networkActivityIndicatorVisible = false
}