UIWindow height control on call

I work in an application IOSwhere all the work is done programmatically, and we have not used autolayoutin the full application.

But for a long time I ran into one problem: when I got a call or my hot spot is on, in this case the height of the status bar of the device changes.

So, in this case, I can control the application frameto control mine UIView's.

Thanks in advance.

+4
source share
2 answers

A good way is to correctly define representations and subqueries using code (in your case).

AppDelegate.m:

-(void)application:(UIApplication *)application didChangeStatusBarFrame (CGRect)oldStatusBarFrame 
{
   // update layout
}

.

:

view.autoresizingMask = UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin;
0

, , . AppDelegate.m . , . , .

//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
//}

:

enter image description here

Bar Height

enter image description here

:

enter image description here . .

0

Source: https://habr.com/ru/post/1673689/


All Articles