else
keyboardHeight = keyboardFrame.size.width;
} else
keyboardHeight = 0;
} else {
keyboardHeight = self.visibleKeyboardHeight;
}
CGRect orientationFrame = [UIScreen mainScreen].bounds;
CGRect statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
if(UIInterfaceOrientationIsLandscape(orientation)) {
float temp = orientationFrame.size.width;
orientationFrame.size.width = orientationFrame.size.height;
orientationFrame.size.height = temp;
temp = statusBarFrame.size.width;
statusBarFrame.size.width = statusBarFrame.size.height;
statusBarFrame.size.height = temp;
}
CGFloat activeHeight = orientationFrame.size.height;
if(keyboardHeight > 0)
activeHeight += statusBarFrame.size.height*2;
activeHeight -= keyboardHeight;
CGFloat posY = floor(activeHeight*0.45);
CGFloat posX = orientationFrame.size.width/2;
CGPoint newCenter;
CGFloat rotateAngle;
switch (orientation) {
case UIInterfaceOrientationPortraitUpsideDown:
rotateAngle = M_PI;
newCenter = CGPointMake(posX, orientationFrame.size.height-posY);
break;
case UIInterfaceOrientationLandscapeLeft:
rotateAngle = -M_PI/2.0f;
newCenter = CGPointMake(posY, posX);
break;
case UIInterfaceOrientationLandscapeRight:
rotateAngle = M_PI/2.0f;
newCenter = CGPointMake(orientationFrame.size.height-posY, posX);
break;
rotateAngle = 0.0;
newCenter = CGPointMake(posX, posY);
break;
}
if(notification) {
[UIView animateWithDuration:animationDuration
delay:0
options:UIViewAnimationOptionAllowUserInteraction
animations:^{
[self moveToPoint:newCenter rotateAngle:rotateAngle];
} completion:NULL];
}
else {
[self moveToPoint:newCenter rotateAngle:rotateAngle];
}
}
- (void)moveToPoint:(CGPoint)newCenter rotateAngle:(CGFloat)angle {
self.hudView.transform = CGAffineTransformMakeRotation(angle);
self.hudView.center = newCenter;
}
#pragma mark - Master show/dismiss methods
- (void)showWithStatus:(NSString*)string maskType:(SVProgressHUDMaskType)hudMaskType networkIndicator:(BOOL)show {
dispatch_async(dispatch_get_main_queue(), ^{
if(!self.superview)
[self.overlayWindow addSubview:self];
self.fadeOutTimer = nil;
self.imageView.hidden = YES;
self.maskType = hudMaskType;
[self setStatus:string];
[self.spinnerView startAnimating];
if(self.maskType != SVProgressHUDMaskTypeNone) {
self.overlayWindow.userInteractionEnabled = YES;
} else {
self.overlayWindow.userInteractionEnabled = NO;
}
[self.ov