Web ページの読み込み中に ATM HUD を使用する UIWebView があります。HUD を動作させることはできますが、Web ページがロードされた後もそのままです。ロード後に HUD の回転を止める方法を見つける必要があります。以下は私がこれまでに持っているコードです..
@implementation ThenewsViewController
@synthesize hud;
- (void)showHud {
// Show hud with activity indicator
NSLog(@"hud: %@", hud);
if (!hud) {
hud = [[ATMHud alloc] initWithDelegate:self];
[self.navigationController.view addSubview:hud.view];
[hud setCaption:@"Loading news..."];
[hud setActivity:YES];
[hud update];
if (![hud isBeingPresented])
[hud show];
} else {
NSLog(@"hud exists... resetting.");
hud = nil;
[self showHud];
}
}
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
NSURL *myURL = [NSURL URLWithString:@"http://www.hiphopdx.com/m/index.php?s=news"];
NSURLRequest *myRequest = [NSURLRequest requestWithURL:myURL];
[myWebView loadRequest:myRequest];
UIColor *navBarColor = UIColorFromRGB(0x089932);
[[self.navigationController navigationBar] setTintColor:navBarColor];
if (![hud isBeingPresented])
[self showHud];
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)viewDidFinishLoad:(UIWebView *)webView
{
NSLog(@"Done loading web view");
[hud hide];
}
@end