Permalink
Browse files

Merge pull request #103 from dontangg/HUDForView-enhancement

HudForView: performance enhancement
  • Loading branch information...
2 parents 0151c89 + 7dffd6c commit 0c579a90106e83f3e90e012ee25985377cfdde65 @matej matej committed Nov 17, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 MBProgressHUD.m
View
@@ -125,15 +125,15 @@ + (NSUInteger)hideAllHUDsForView:(UIView *)view animated:(BOOL)animated {
}
+ (MBProgressHUD *)HUDForView:(UIView *)view {
- MBProgressHUD *hud = nil;
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]) {
- hud = (MBProgressHUD *)aView;
+ return (MBProgressHUD *)aView;
}
}
- return hud;
+ return nil;
}
+ (NSArray *)allHUDsForView:(UIView *)view {

0 comments on commit 0c579a9

Please sign in to comment.