I would like to use MBProgressHUD with...
[HUD showWhileExecuting:@selector(fetchDomainStatus) onTarget:self withObject:nil animated:YES];
but I need to call a method (fetchDomainStatus) that returns the domainStatus (an int).
How can I do that without somekind of class variable?
If you can use blocks (i.e., your app is iOS 4.0+) you can do something like this, and still have all threading magic preserved:
MBProgressHUD *hud = [MBProgressHUD showHUDAddedTo:self.view animated:YES];
dispatch_async(dispatch_get_global_queue( DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
// Do the task in the background
int status = [self fetchDomainStatus];
// Hide the HUD in the main tread
dispatch_async(dispatch_get_main_queue(), ^{
[MBProgressHUD hideHUDForView:self.view animated:YES];
});
});