Forum Xamarin.Forms
We are excited to announce that the Xamarin Forums are moving to the new Microsoft Q&A experience. Q&A is the home for technical questions and answers at across all products at Microsoft now including Xamarin!

We encourage you to head over to Microsoft Q&A for .NET for posting new questions and get involved today.

Maps with callout shown not filling the screen after changing orientation

We have a Xamarin Forms ( app which uses Xamarin.Forms.Maps.Map (, but it looks like the map won't fill the screen if we rotate the iPad from landscape to portrait and then rotate it back to landscape while a callout view is shown. It will leave a blank space to the right of the screen. This won't happen if the callout is not shown. We tested this in iOS 9.2 (13C75) only. Here is an example that can demonstrate this. It shows a map which fills the full screen, and there is a pin in the map. Click on the pin to show the callout, and then rotate the device from landscape to portrait and rotate it back.

This seems to be a bug, but I like to make sure I didn't miss anything in my code. Any one had similar experience?

    [Register ("AppDelegate")]
    public partial class AppDelegate : global::Xamarin.Forms.Platform.iOS.FormsApplicationDelegate
        public override bool FinishedLaunching (UIApplication app, NSDictionary options)
            global::Xamarin.Forms.Forms.Init ();


            LoadApplication (new App ());

            return base.FinishedLaunching (app, options);

    public class App : Application
        public App ()
            var map = new Map (MapSpan.FromCenterAndRadius(new Position(0,0), Distance.FromMeters(5))) {
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions = LayoutOptions.FillAndExpand,
            map.Pins.Add (new Pin {
                Label = "test",
                Position = new Position (0, 0)

            MainPage = new ContentPage {
                Content = map,



  • JulienRosenJulienRosen CAMember ✭✭✭✭

    Is this an iPad only thing? Works fine on my iphone.

  • GeerShuangGeerShuang USMember ✭✭
    edited January 2016

    Looks like it's only a problem for iPad. I tried it on iPhone, and it works for me as well. You can reproduce this in simulators, such as iPad Air 2 iOS 9.2, iPad Retina iOS 9.2, iPad 2...
    Is there anything special I need to do to make it work on iPad?

  • GeerShuangGeerShuang USMember ✭✭

    After debugging into it more, I realized the AutoresizingMask is set to None (or not set) for MapRenderer, MKMapView, and the SuperView of the MapRenderer for some reason, and I believe that's why the map wasn't resizing properly. In my real case, the SuperView is the renderer for RelativeLayout. I didn't find a specific one for RelativeLayout, so it's using VisualElementRenderer.
    I created custom renderers to set the AutoresizingMask to FlexibleDimensions for those renderers and it fixed the problem. Although I still think this is a bug in Xamarin, I think this hack might be useful to others experiencing the same problem.

Sign In or Register to comment.