 
 private var xoTimerAssociationKeyy: NSTimer        = NSTimer()
 
-private let _LoaderHUDSharedInstance = LoaderHUD(frame: CGRectMake(0.0, -20.0,
-                                                                   CGRectGetWidth(UIScreen.mainScreen().bounds), 2.0))
+private let _LoaderHUDSharedInstance = LoaderHUD(frame: CGRectMake(0.0, -20.0, CGRectGetWidth(UIScreen.mainScreen().bounds), 2.0))
 
 class LoaderHUD: UIView {
     
     var factoryTimer: NSTimer?
     
     var foregroundColor: UIColor?
+    
+    override init(frame: CGRect) {
+        
+        super.init(frame: frame)
+        
+        orientationDidChange(nil)
+        
+        NSNotificationCenter.defaultCenter().addObserver(self, selector: "orientationDidChange:", name: UIDeviceOrientationDidChangeNotification, object: nil)
+    }
+
+    required init(coder aDecoder: NSCoder) {
+        super.init(coder: aDecoder)
+    }
     
     class var sharedInstance: LoaderHUD {
         return _LoaderHUDSharedInstance

        
        loadingView.layer.addAnimation(animation, forKey: "basic")
    }
}

extension UIViewController {

    func startLoadingAnimation(animated: Bool) -> Void {
        
        stopLoadingAnimation(false)
            
        UIView.animateWithDuration((animated ? 0.2 : 0.0), animations: { () -> Void in
            LoaderHUD.sharedInstance.alpha = 1.0
        })
