Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Source/MMProgressHUD.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ This message will be presented to the user when a cancelBlock is present after t

/** The overlay view that is placed just behind the HUD.
*/
@property (nonatomic, strong, readonly) MMProgressHUDOverlayView *overlayView;
@property (nonatomic, strong) MMProgressHUDOverlayView *overlayView;

/** The class to use for the progress view. Instances of this class must confrom to the MMProgressView protocol. When setting a custom value this value must be set before setting the indeterminate property to YES.

Expand Down
18 changes: 7 additions & 11 deletions Source/MMProgressHUD.m
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,6 @@ @interface MMProgressHUD () <MMHudDelegate>
@property (nonatomic, copy) NSArray *animationImages;
@property (nonatomic, strong) CAAnimation *queuedShowAnimation;
@property (nonatomic, strong) CAAnimation *queuedDismissAnimation;
@property (nonatomic, readwrite, strong) MMProgressHUDOverlayView *overlayView;
@property (nonatomic, strong) NSTimer *dismissDelayTimer;
@property (nonatomic, copy) NSString *tempStatus;
@property (nonatomic, strong) NSTimer *confirmationTimer;
Expand Down Expand Up @@ -451,24 +450,21 @@ - (void)_updateHUD {
}

- (CGPoint)_windowCenterForHUDAnchor:(CGPoint)anchor {

CGFloat hudHeight = CGRectGetHeight(self.hud.frame);

CGPoint position;
if (UIInterfaceOrientationIsPortrait([[self.window rootViewController] interfaceOrientation])) {

CGFloat systemVersion = [[[UIDevice currentDevice] systemVersion] floatValue];
CGPoint position = CGPointMake(0, 0);
if (UIInterfaceOrientationIsPortrait([[self.window rootViewController] interfaceOrientation]) || systemVersion >= 8) {
CGFloat y = roundf(self.window.center.y + (anchor.y - 0.5f) * hudHeight);
CGFloat x = roundf(self.window.center.x);

position = CGPointMake(x, y);
}
else {
} else if (UIInterfaceOrientationIsLandscape([[self.window rootViewController] interfaceOrientation])) {
CGFloat x = roundf(self.window.center.y);
CGFloat y = roundf(self.window.center.x + (anchor.y - 0.5f) * hudHeight);

position = CGPointMake(x, y);
}

return [self _antialiasedPositionPointForPoint:position forLayer:self.hud.layer];
}

Expand Down
9 changes: 8 additions & 1 deletion Source/MMProgressHUDViewController.m
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

#import "MMProgressHUDViewController.h"
#import "MMProgressHUDWindow.h"
#import "MMProgressHUD.h"
#import "MMProgressHUDOverlayView.h"
#import "MMProgressHUDCommon.h"


Expand Down Expand Up @@ -121,4 +121,11 @@ - (BOOL)prefersStatusBarHidden{
return [[UIApplication sharedApplication] isStatusBarHidden];
}

- (void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {
MMProgressHUD *hud = (MMProgressHUD *)self.view;
hud.overlayView.frame = self.view.bounds;
[hud.overlayView setNeedsDisplay];
[super willAnimateRotationToInterfaceOrientation:toInterfaceOrientation duration:duration];
}

@end
28 changes: 0 additions & 28 deletions Source/MMProgressHUDWindow.m
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,6 @@ - (UIWindow *)oldWindow {
}
#pragma clang diagnostic pop

- (void)setRootViewController:(UIViewController *)rootViewController {
[super setRootViewController:rootViewController];

[self orientRootViewControllerForOrientation:rootViewController.interfaceOrientation];
}

- (void)orientRootViewControllerForOrientation:(UIInterfaceOrientation)interfaceOrientation {
CGAffineTransform transform;

switch (interfaceOrientation) {
case UIInterfaceOrientationLandscapeRight:
transform = CGAffineTransformMakeRotation(M_PI_2);
break;
case UIInterfaceOrientationLandscapeLeft:
transform = CGAffineTransformMakeRotation(-M_PI_2);
break;
case UIInterfaceOrientationPortraitUpsideDown:
transform = CGAffineTransformMakeRotation(M_PI);
break;
default:
case UIInterfaceOrientationPortrait:
transform = CGAffineTransformIdentity;
break;
}

self.rootViewController.view.transform = transform;
}

- (void)dealloc {
MMHudLog(@"dealloc");
}
Expand Down