Skip to content

Instantly share code, notes, and snippets.

@dvdsgl
Created December 14, 2012 22:59
Show Gist options
  • Save dvdsgl/4289386 to your computer and use it in GitHub Desktop.
Save dvdsgl/4289386 to your computer and use it in GitHub Desktop.
// Register an API key in your AppDelegate's FinsihedLaunching method:
// GMSServices.ProvideAPIKey ("Your API key.");
GMSMapView mapView;
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
// Create the map view, framing Xamarin headquarters
mapView = new GMSMapView {
Camera = new GMSCamera (37.797865, -122.402526, 6)
};
// Add a marker for Sydney.
var xamarinhq = new GMSMarkerOptions {
Title = "Xamarin HQ",
Snippet = "Where the magic happens.",
Position = new CLLocationCoordinate2D (37.797865, -122.402526)
};
mapView.AddMarker (xamarinhq);
// Set the map as our main view.
View = mapView;
}
public override void ViewWillAppear (bool animated)
{
base.ViewWillAppear (animated);
mapView.StartRendering ();
}
public override void ViewWillDisappear (bool animated)
{
base.ViewWillDisappear (animated);
mapView.StopRendering ();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment