活动指标未显示

时间:2011-11-05 16:45:11

标签: ios uiactivityindicatorview

问题是我的活动指示器没有显示任何人的想法?

ViewController.h

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController 
{
    IBOutlet UIWebView *webview;
    IBOutlet UIActivityIndicatorView *active;
    UIAlertView *alert_start;   
}

ViewController.m

// Do any additional setup after loading the view, typically from a nib.
[webview loadRequest:[NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"home-de" ofType:@"html"]isDirectory:NO]]];

- (void)webViewDidStartLoad:(UIWebView *) webview 
{  
    [UIApplication sharedApplication].networkActivityIndicatorVisible = YES;
    [active startAnimating]; 
}

- (void)webViewDidFinishLoad:(UIWebView *) webview 
{ 
    [UIApplication sharedApplication].networkActivityIndicatorVisible = NO;
    [active stopAnimating];
}

- (IBAction)tele_button:(id)sender
{
    //Local HTML Call Button
    NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"phone" ofType:@"html"]isDirectory:NO]];
    [self->webview loadRequest:theRequest];
}

- (IBAction)mail_button:(id)sender
{
    //Mail App Mail Button
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"mailto://info@optibelt.com"]];
}

- (IBAction)web_button:(id)sender
{
    //Local HTML Button
    NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL URLWithString: @"http://optibelt.com"]];
    [self->webview loadRequest:theRequest];
}

- (IBAction)news_button:(id)sender
{
    //local Home Button
    NSURLRequest *theRequest = [NSURLRequest requestWithURL:[NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"home-de" ofType:@"html"]isDirectory:NO]];
    [self->webview loadRequest:theRequest];
}

活动指示器设置为行为动画(已选中),并在停止(已选中)时隐藏

如果我得到一些帮助会很棒:)

1 个答案:

答案 0 :(得分:1)

您可能想要检查一些事情。首先,检查IB中是否连接了活动指示灯插座。其次,检查活动指示符是否在UIWebview之上。可能是它被掩盖了。您可能还想检查它是否未在IB中隐藏。

祝你好运