     }
 }
 
-    // MARK: - Class methods
+// MARK: - Class methods
 extension MBProgressHUD {
     
     class func showHUDAddedTo(view: UIView, animated: Bool) -> MBProgressHUD {

                self.addSubview(indicator!)
            }
            (indicator as! UIActivityIndicatorView).color = activityIndicatorColor
        } else if mode == MBProgressHUDMode.MBProgressHUDModeDeterminateHorizontalBar {
            indicator?.removeFromSuperview()
            indicator = MBBarProgressView()
            self.addSubview(indicator!)
        } else if mode == MBProgressHUDMode.MBProgressHUDModeDeterminate || mode == MBProgressHUDMode.MBProgressHUDModeAnnularDeterminate {
            if !isRoundIndicator {
                indicator?.removeFromSuperview()
                indicator = MBRoundProgressView()
                self.addSubview(indicator!)
            }
            if mode == MBProgressHUDMode.MBProgressHUDModeAnnularDeterminate {
                (indicator as! MBRoundProgressView).annular = true
            }
        } else if mode == MBProgressHUDMode.MBProgressHUDModeCustomView && customView != indicator {
            indicator?.removeFromSuperview()
            self.indicator = customView
            self.addSubview(indicator!)
        } else if mode == MBProgressHUDMode.MBProgressHUDModeText {
            indicator?.removeFromSuperview()
            indicator = nil
        }
    }
    
    // MARK: - Notificaiton
    func registerForNotifications() {
        NSNotificationCenter.defaultCenter().addObserver(self, selector: "statusBarOrientationDidChange:", name: UIApplicationDidChangeStatusBarOrientationNotification, object: nil)
    }
    
    func unregisterFromNotifications() {
        NSNotificationCenter.defaultCenter().removeObserver(self, name: UIApplicationDidChangeStatusBarOrientationNotification, object: nil)
    }
    
    func statusBarOrientationDidChange(notification: NSNotification) {
        if let superView = self.superview {
            self.updateForCurrentOrientationAnimaged(true)
        }
    }
    
    func updateForCurrentOrientationAnimaged(animated: Bool) {
        // Stay in sync with the superview in any case
        if self.superview != nil {
            self.bounds = self.superview!.bounds

        }
    }
    
    var animationType = MBProgressHUDAnimation.Fade
    var mode = MBProgressHUDMode.Indeterminate {
        didSet {
            self.updateIndicators()
            self.swift_performSelectorOnMainThread("setNeedsLayout", withObject: nil, waitUntilDone: false)
