编辑:我解决了
我解决了。我变了:
@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];
为什么这不起作用?你有什么想法?