我使用此代码显示 MBProgress
- (void)showSimple {
// The hud will dispable all input on the view (use the higest view possible in the view hierarchy)
HUD = [[MBProgressHUD alloc] initWithView:self.view];
[self.view addSubview:HUD];
// Regiser for HUD callbacks so we can remove it from the window at the right time
HUD.delegate = self;
// Show the HUD while the provided method executes in a new thread
[HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];}
- (void)myTask {
// Do something usefull in here instead of sleeping ...
sleep(3);
}
我希望在不运行 MyTask 但此方法时显示活动指示器
- (void)request:(FBRequest *)request didLoad:(id)result {
}
我试图改变
[HUD showWhileExecuting:@selector(myTask) onTarget:self withObject:nil animated:YES];
到
[HUD showWhileExecuting:@selector(request) onTarget:self withObject:nil animated:YES];
或者
[HUD showWhileExecuting:@selector(didLoad) onTarget:self withObject:nil animated:YES];
但它不起作用