I used this:
UIApplication.sharedApplication().keyWindow?.rootViewController!.view.addSubview(self.customView)
Adding a modal view to all views in the view hierarchy in the application.
But that gives me a problem. Sometimes it adds a subview, but sometimes it doesn't work. In which case this will not work and what is the best way to add a modal view to the view hierarchy, such as UIAlertView.
, , UIWindow - , , ( , ). < > . , keyWindow.
, subview , : UIApplication.sharedApplication().windows.last?.addSubview(yourSubView).
UIApplication.sharedApplication().windows.last?.addSubview(yourSubView)
, , : UIApplication.sharedApplication().delegate?.window.
UIApplication.sharedApplication().delegate?.window