[IOS] Status bar related settings

// Write the adaptation method in the corresponding ViewController
- (void)adapterstatusBarHeight{
// The reason why this code is added is because when setting a personal wifi hotspot, etc., the height of the status bar will change from 20 pixels to 40 pixels
// Cause the bottom tab to be squeezed out a part, so in this case, the Y coordinate of the tab will be moved up by 20 pixels
CGRect statusBarRect = [[UIApplication sharedApplication] statusBarFrame];
int shouldBeSubtractionHeight = 0;
if (statusBarRect.size.height == 40) {
shouldBeSubtractionHeight = 20;
}
if ([[UIDevice currentDevice].systemVersion floatValue]>=7.0[[UIDevice currentDevice].systemVersion floatValue]<6.0) {
tabBar.frame = CGRectMake(0, __MainScreen_Height-49 - shouldBeSubtractionHeight , 320, 49);
}else{
tabBar.frame =CGRectMake(0, __MainScreen_Height-69 - shouldBeSubtractionHeight , 320, 49);
}
}

Call this function in AppDelegate
- (void)applicationDidBecomeActive:(UIApplication *)application
{
// Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
[[UIApplication sharedApplication] cancelAllLocalNotifications];
application.applicationIconBadgeNumber = 0;
[[mainViewController sharedmain] adapterstatusBarHeight];
}

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326194714&siteId=291194637