Whenever the height of the status bar changes the following functions will be called. Just add these functions to your AppDelegate.m
file. They will be called when the status bar changes its height. One of them is called before and the other after the change.
//Called before the change
- (void)application:(UIApplication *)application willChangeStatusBarFrame:(CGRect)newStatusBarFrame
{
//Change the size of Window
self.window.frame = CGRectMake(0.0f, 60.0f, 200.0f, 200.0f);
//In your case it will be
//self.window.frame = CGRectMake(0.0f, 40.0f, self.window.frame.size.width, self.window.frame.size.height - 40);
}
//Called after the change
//- (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame{
//Change the size of Window
//}
Starting :

Changing statusBar Height by toggling in-Call Status Bar

Final Result with Changed Frame:
Hope this helps. Happy Coding.
Reference