Add following line in viewDidLoad:
[[UIApplication sharedApplication] setStatusBarHidden:YES withAnimation:UIStatusBarAnimationFade];
and add new method
- (BOOL)prefersStatusBarHidden {
return YES;
}
also change info.plist file
View controller-based status bar appearance" = NO
And also add condition for iPhone 6 and 6 Plus.Here are the methods for iPhone 6 and 6 Plus:
/*=====================================================================================================================
Checks if the device has 4.7 inch screen such as iPhone6 generation
=====================================================================================================================*/
+(BOOL) ISiPhone6
{
BOOL isIpad = ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad);
CGRect screenRect = [[UIScreen mainScreen] bounds];
// we need to check the maximum of width and height because some screens (the camera view while scanning) we can
// rotate to portrait or landscape and in the case the screen height and width flip
return (!isIpad && MAX(screenRect.size.height,screenRect.size.width) == 667);
}
/*=====================================================================================================================
Checks if the device has 5.5 inch screen such as iPhone6 plus
=====================================================================================================================*/
+(BOOL) ISiPhone6Plus
{
BOOL isIpad = ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPad);
CGRect screenRect = [[UIScreen mainScreen] bounds];
// we need to check the maximum of width and height because some screens (the camera view while scanning) we can
// rotate to portrait or landscape and in the case the screen height and width flip
return (!isIpad && MAX(screenRect.size.height,screenRect.size.width) == 736);
}
it's works for me.