Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Resizing an iOS view with Xamarin.iOS when call status bar is toggled

Is there a trick to detecting when the status bar changes height due to a phone call in Xamarin.iOS?

I'm trying to adapt the excellent instructions from this post to work in Xamarin, and the ChangedStatusBarFrame method is never called.

The following code doesn't do anything in a brand new Xamarin iPhone project:

public virtual void ChangedStatusBarFrame(UIApplication application, RectangleF oldStatusBarFrame)
{
    Debug.WriteLine("Y U NO work!");
}

I tried the equivalent in a new native iPhone app and it worked perfectly:

- (void)application:(UIApplication *)application didChangeStatusBarFrame:(CGRect)oldStatusBarFrame
{
    NSLog(@"Hey, the status bar changed size!");
}

I'm testing this on the iOS simulator by toggling the status bar.

I'm using Xamarin.iOS version 6.4.3.0 and XCode 4.6.3.

Any suggestions?

like image 355
Josh Earl Avatar asked Nov 20 '25 16:11

Josh Earl


1 Answers

You should use override keyword:

public override void ChangedStatusBarFrame(UIApplication application, RectangleF oldStatusBarFrame)
{
    Debug.WriteLine("Y U NO work!");
}
like image 87
Daria Trainor Avatar answered Nov 22 '25 22:11

Daria Trainor