UIViewController.View.Window is null in ViewDidLoad method

前端 未结 3 955
自闭症患者
自闭症患者 2021-01-03 23:15

Regardless on which controller type (UIViewController, UITableViewController), the following line always yields null in the View

3条回答
  •  臣服心动
    2021-01-03 23:46

    Instead of self.view.window use

    [(YourAppDelegate *)[[UIApplication sharedApplication] delegate] window]
    

提交回复
热议问题