Regardless on which controller type (UIViewController, UITableViewController), the following line always yields null in the View
UIViewController
UITableViewController
null
View
Instead of self.view.window use
self.view.window
[(YourAppDelegate *)[[UIApplication sharedApplication] delegate] window]