erica / iphone-3.0-cookbook-

Sample Code
912 stars 305 forks source link

a small issue of ModalHUD.m #2

Closed xhan closed 14 years ago

xhan commented 14 years ago

While calling [ModalHUD dismiss]; immediately after [ModalHUD showHUD:@"***"]; invoked , The alertView will not dismiss as expected.

-(void) dismiss { UIAlertView av = (UIAlertView )[[[UIApplication sharedApplication] keyWindow] viewWithTag:MODAL_HUD_UNIQUE_ID]; // Wait for av to finish displaying if(!av) { // NSLog(@"wanted for find alertView"); [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(dismiss) userInfo:nil repeats:NO]; } [av dismissWithClickedButtonIndex:0 animated:YES]; }

erica commented 14 years ago

Changed dismiss to a boolean method that can be tested against and performed again until success. Gave credit as xhan. Let me know if you want that to change to a real name. Thanks, — E