show UIAlertController outside of ViewController

前端 未结 4 2177
隐瞒了意图╮
隐瞒了意图╮ 2021-02-01 07:43

I have trouble to display my UIAlertController because I\'m trying to show it in a Class which is not an ViewController.

I already tried adding it:

 var          


        
4条回答
  •  無奈伤痛
    2021-02-01 08:33

    This should work.

     UIApplication.sharedApplication().windows[0].rootViewController?.presentViewController(...)
    

提交回复
热议问题