             self.backgroundView.alpha = 0
         }
         
-        self.contentView = view
-        
-        self.contentView.center = CGPoint(x: (keyWindowBounds?.midX)!, y: (keyWindowBounds?.midY)!)
-        
         self.addSubview(backgroundView)
         
+        self.contentView = view
+        self.contentView.center = CGPoint(x: (keyWindowBounds?.midX)!, y: (keyWindowBounds?.midY)!)
         self.addSubview(contentView)
-        
         
         if dismissOnBackgroundTap {
             
             let tapRecognizer = UITapGestureRecognizer(target: self, action: #selector(NMCustomView.dismiss))
-            
             self.backgroundView.addGestureRecognizer(tapRecognizer)
         }
         

            
        }
        
        
        let center: CGPoint? = keyWindow?.center
        
        if(center != nil) {
            
            self.contentView.center = center!
            
        }
        
    }
    
    func dismiss() {

        }) { (Bool) -> Void in
            self.removeFromSuperview()
        }
    }
}
