0

I have YTPlayerView on my viewController. If i create UIAlertController and show it by method self.present(alertView, animated: true, completion: nil) , alert will be shown under player view. How can i show alertView above all views on my viewController?

Here the code that i use now:

let title = "test alert message" let alert = UIAlertController(title: title, message: nil, preferredStyle: UIAlertControllerStyle.alert)
    alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil))
    UIApplication.shared.keyWindow?.rootViewController?.present(‌​alert, animated: true, completion: nil)
AleksRevolt
  • 121
  • 7
  • use appdelegate window instance or YTPlayerView instance to present alert , it will come on top – Vinodh Oct 28 '16 at 12:43
  • Not work for me – AleksRevolt Nov 10 '16 at 11:22
  • what error you are getting ?. Please post detailed are you showing alert from Viewcontroller – Vinodh Nov 11 '16 at 06:15
  • `let title = "test alert message" let alert = UIAlertController(title: title, message: nil, preferredStyle: UIAlertControllerStyle.alert) alert.addAction(UIAlertAction(title: "OK", style: UIAlertActionStyle.default, handler: nil)) UIApplication.shared.keyWindow?.rootViewController?.present(alert, animated: true, completion: nil)` Here the code that i use. I not get any errors - but alert not shown above player view. – AleksRevolt Nov 14 '16 at 14:19
  • Post it in question – Vinodh Nov 14 '16 at 14:31

0 Answers0