簡體   English   中英

如何在UIWebView加載內容時顯示加載消息?

[英]How to show a loading message while UIWebView loads it's content?

當UIWebView加載其內容以便它不會只顯示空白視圖時,我想放置一個大的微調器以及“正在加載消息...”或gif圖像。 我該怎么辦?

實現UIWebview的委托方法將此代碼放入其中

- (void)webViewDidStartLoad:(UIWebView *)webView {
    [activityIndicator startAnimating];
    myLabel.hidden = FALSE;
}

- (void)webViewDidFinishLoad:(UIWebView *)webView {
[activityIndicator stopAnimating];
myLabel.hidden = TRUE;
}

當stop屬性為TRUE時,設置ActivityIndi​​cater的Hidden

按照Mihir上面的回答中的概述實現UIWebView Delegate,但不要忘記分配委托,否則不會觸發委托方法

例如,在ViewDidLoad中,您應該添加:

self.myWebView.delegate = self;

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM