Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

UIViewController messes up when personal hot spot is turned on

When I turn on personal hot spot connection, my layout gets pushed down. How can I either remove this hot spot bar at the top or get a notification for this bar and rearrange my view according to it? Thanks. enter image description here

like image 776
user635064 Avatar asked Jul 04 '11 02:07

user635064


1 Answers

When the size of your status bar changes, your application delegate method is called. All you have to do is handle that selector and update your view manually (if autoresizing isn't something you would go with). Here's what you need to add to your app delegate:

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

However, as @sosborn has mentioned, it might be a lot simpler to make sure that your views and subviews have autoresizing (aka springs and struts) set correctly (either in code or through the interface builder).

One last note: you can always query for the status bar frame (and therefore size) by calling: [[UIApplication sharedApplication] statusBarFrame]

like image 155
Nick Avatar answered Nov 04 '22 21:11

Nick