jdg / MBProgressHUD

MBProgressHUD + Customizations
http://www.bukovinski.com/
MIT License
16.01k stars 3.56k forks source link

add completion block for hide:afterDelay #321

Closed leon0103 closed 8 years ago

leon0103 commented 8 years ago

use example:

-(void)showIcon:(NSString)imageName withTitle:(NSString)title description:(NSString)description { MBProgressHUD hud = [MBProgressHUD showHUDAddedTo:[self window] animated:YES]; hud.mode = MBProgressHUDModeCustomView; hud.customView = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:imageName]] autorelease]; hud.labelText = title; hud.detailsLabelText = description; hud.margin = 20.f; hud.removeFromSuperViewOnHide = YES; [hud hide:YES afterDelay:3 completion:^{ [self releaseWindow]; }]; }

matej commented 8 years ago

Might really be handy to have a completion block in this case. Perhaps even replace the delegate with just blocks. An exposed completionBlock property seems more useful to me than adding a completion block parameter to various calls.

coderomw commented 8 years ago

however,i didn't find the method:@selector(hide:afterDelay: completion:^{}) in version 0.9.2 , but only the method:@selector( hide:afterDelay: ) ,can you help me?