編集:私はそれを解決しました
私はそれを解決しました。私が変更され:
@property(nonatomic,retain) UIActivityIndicatorView *activityIndicator;
に
@property(nonatomic,retain) IBOutlet UIActivityIndicatorView *activityIndicator;
私の質問:
シンプルなUIWebViewアプリを作成していますが、ウェブページの読み込みが完了したらインジケーターの回転を停止したいと思います。ストーリーボードインターフェイスで[完了したら非表示]をオンにし、インジケーターをビューコントローラー(activityIndicator)に接続しました。それでも止まらない。私のヘッダーファイルには、次のものがあります。
@interface ViewController : UIViewController<UIWebViewDelegate>{
IBOutlet UIBarButtonItem *bBack, *bForward, *toolbarStop, *toolbarRefresh;
IBOutlet UIActivityIndicatorView *_activityIndicator;
BOOL internetOK;
NSTimer *timer;
}
-(void)tryInternet;
-(void)loading;
-(void)startAnimating;
-(void)stopAnimating;
-(void)verifyInternet;
-(IBAction)refresh:(id)sender;
-(IBAction)dontTouchMe:(id)sender;
-(IBAction)refreshWebView:(id)sender;
@property (weak, nonatomic) IBOutlet UIWebView *webview;
@property(nonatomic,retain) UIActivityIndicatorView *activityIndicator;
そして私の.mファイルにはこれがあります:
- (void)webViewDidStartLoad:(UIWebView *)webView {
[_activityIndicator startAnimating];
}
- (void)webViewDidFinishLoad:(UIWebView *)webView {
[_activityIndicator stopAnimating];
なぜこれが機能しないのですか?あなたはなにか考えはありますか?