public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. // add the map view var map = new MKMapView(UIScreen.MainScreen.Bounds); View.Add(map); // change the map style map.MapType = MKMapType.Standard; // enable/disable interactions // map.ZoomEnabled = false; // map.ScrollEnabled = false; // show user location if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { locationManager.RequestWhenInUseAuthorization(); } map.ShowsUserLocation = true; // specify a custom map delegate var mapDelegate = new MyMapDelegate(); map.Delegate = mapDelegate; // add a point annotation map.AddAnnotation(new MKPointAnnotation() { Title = "MyAnnotation", Coordinate = new CLLocationCoordinate2D(42.364260, -71.120824) }); // add a custom annotation // map.AddAnnotation(new CustomAnnotation("CustomSpot", new CLLocationCoordinate2D(38.364260, -68.120824))); // TODO: Step 4a - draw a circle overlay var circleOverlay = MKCircle.Circle(new CLLocationCoordinate2D(33.755, -84.39), 100 * 1609.34); // 1609.34 = meters in a mile map.AddOverlay(circleOverlay); // TODO: Step 4b - draw a polygon (Wyoming) var stateOverlay = MKPolygon.FromCoordinates(new CLLocationCoordinate2D[] { new CLLocationCoordinate2D(45.00, -111.00), new CLLocationCoordinate2D(45, -104), new CLLocationCoordinate2D(41, -104), new CLLocationCoordinate2D(41, -111) }); map.AddOverlay(stateOverlay); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. // add the map view var map = new MKMapView(UIScreen.MainScreen.Bounds); View.Add(map); // change the map style map.MapType = MKMapType.Standard; // enable/disable interactions // map.ZoomEnabled = false; // map.ScrollEnabled = false; // show user location if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) { locationManager.RequestAlwaysAuthorization (); } map.ShowsUserLocation = true; // specify a custom map delegate var mapDelegate = new MyMapDelegate(); map.Delegate = mapDelegate; // add a point annotation map.AddAnnotation(new MKPointAnnotation() { Title = "MyAnnotation", Coordinate = new CLLocationCoordinate2D(42.364260, -71.120824) }); // add a custom annotation // map.AddAnnotation(new CustomAnnotation("CustomSpot", new CLLocationCoordinate2D(38.364260, -68.120824))); // TODO: Step 4a - draw a circle overlay // var circleOverlay = MKCircle.Circle(new CLLocationCoordinate2D(33.755, -84.39), 100 * 1609.34); // 1609.34 = meters in a mile // map.AddOverlay(circleOverlay); // TODO: Step 4b - draw a polygon (Wyoming) // var stateOverlay = MKPolygon.FromCoordinates(new CLLocationCoordinate2D[] // { // new CLLocationCoordinate2D(45.00, -111.00), // new CLLocationCoordinate2D(45, -104), // new CLLocationCoordinate2D(41, -104), // new CLLocationCoordinate2D(41, -111) // }); // map.AddOverlay(stateOverlay); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. // add the map view var map = new MKMapView(UIScreen.MainScreen.Bounds); View.Add(map); // change the map style map.MapType = MKMapType.Standard; // enable/disable interactions // map.ZoomEnabled = false; // map.ScrollEnabled = false; // show user location if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { locationManager.RequestWhenInUseAuthorization(); } map.ShowsUserLocation = true; // TODO: Step 3d - specify a custom map delegate var mapDelegate = new MyMapDelegate(); map.Delegate = mapDelegate; // Add a point annotation map.AddAnnotation(new MKPointAnnotation() { Title = "MyAnnotation", Coordinate = new MonoTouch.CoreLocation.CLLocationCoordinate2D(42.364260, -71.120824) }); // TODO: Step 3f - add a custom annotation map.AddAnnotation(new CustomAnnotation("CustomSpot", new MonoTouch.CoreLocation.CLLocationCoordinate2D(38.364260, -68.120824))); // TODO: Step 3a - remove old GetViewForAnnotation delegate code to new delegate - we will recreate this next // [removed] }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. // add the map view var map = new MKMapView(UIScreen.MainScreen.Bounds); View.Add(map); // change the map style map.MapType = MKMapType.Standard; // enable/disable interactions // map.ZoomEnabled = false; // map.ScrollEnabled = false; // show user location if (UIDevice.CurrentDevice.CheckSystemVersion(8, 0)) { locationManager.RequestWhenInUseAuthorization(); } map.ShowsUserLocation = true; // specify a custom map delegate var mapDelegate = new MyMapDelegate(); map.Delegate = mapDelegate; // add a point annotation map.AddAnnotation(new MKPointAnnotation() { Title = "MyAnnotation", Coordinate = new CLLocationCoordinate2D(42.364260, -71.120824) }); // TODO: Step 5a - search for an address SearchForAddress(map); // TODO: Step 5c - search for items of interest SearchForLocationsNearPosition(map); }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. // add the map view var map = new MKMapView(UIScreen.MainScreen.Bounds); View.Add(map); // change the map style map.MapType = MKMapType.Standard; // enable/disable interactions // map.ZoomEnabled = false; // map.ScrollEnabled = false; // show user location if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) { locationManager.RequestWhenInUseAuthorization(); } map.ShowsUserLocation = true; // TODO: Step 3d - specify a custom map delegate var mapDelegate = new MyMapDelegate(); map.Delegate = mapDelegate; // Add a point annotation map.AddAnnotation(new MKPointAnnotation() { Title = "MyAnnotation", Coordinate = new MonoTouch.CoreLocation.CLLocationCoordinate2D(42.364260, -71.120824) }); // TODO: Step 3f - add a custom annotation map.AddAnnotation(new CustomAnnotation("CustomSpot", new MonoTouch.CoreLocation.CLLocationCoordinate2D(38.364260, -68.120824))); // TODO: Step 3a - remove old GetViewForAnnotation delegate code to new delegate - we will recreate this next // [removed] }
public override void ViewDidLoad() { base.ViewDidLoad(); // Perform any additional setup after loading the view, typically from a nib. // add the map view var map = new MKMapView(UIScreen.MainScreen.Bounds); View.Add(map); // change the map style map.MapType = MKMapType.Standard; // enable/disable interactions // map.ZoomEnabled = false; // map.ScrollEnabled = false; // show user location if (UIDevice.CurrentDevice.CheckSystemVersion (8, 0)) { locationManager.RequestWhenInUseAuthorization(); } map.ShowsUserLocation = true; // specify a custom map delegate var mapDelegate = new MyMapDelegate(); map.Delegate = mapDelegate; // add a point annotation map.AddAnnotation(new MKPointAnnotation() { Title = "MyAnnotation", Coordinate = new CLLocationCoordinate2D(42.364260, -71.120824) }); // TODO: Step 5a - search for an address SearchForAddress(map); // TODO: Step 5c - search for items of interest SearchForLocationsNearPosition(map); }