Permalink
Browse files

Start looking for the HUD at the end of the subviews array

Since we add it to the end of the array when it is created, that's where
we're most likely to find it again.
  • Loading branch information...
1 parent 271252c commit 7dffd6ce5ba079a27503700299387eee6d38d403 @dontangg dontangg committed Nov 16, 2012
Showing with 2 additions and 1 deletion.
  1. +2 −1 MBProgressHUD.m
View
@@ -127,7 +127,8 @@ + (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated {
+ (MBProgressHUD *)HUDForView:(UIView *)view {
NSArray *subviews = view.subviews;
Class hudClass = [MBProgressHUD class];
- for (UIView *aView in subviews) {
+ for (NSUInteger i = subviews.count - 1; i >= 0; i--) {
+ UIView *aView = [subviews objectAtIndex:i];
if ([aView isKindOfClass:hudClass]) {
return (MBProgressHUD *)aView;
}

0 comments on commit 7dffd6c

Please sign in to comment.