Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

[events protocols delegates] fix error in sample, get rid of old code

  • Loading branch information...
commit 24f2e727b1b4af79211ec66bf3194edc6f823de8 1 parent 2b65484
@kallisto kallisto authored
View
52 Protocols_Delegates_Events/Protocols_Delegates_EventsViewController.cs
@@ -23,29 +23,31 @@ public override void DidReceiveMemoryWarning ()
public override void ViewDidLoad ()
{
base.ViewDidLoad ();
+
+ // HINT: Select the commented example code blocks below and type Command + / to uncomment
- //Exmaple 1 - Using Strongly tryped delegate
+ //Exmaple 1 - Using Strongly typed delegate
//set the map's delegate
- _mapDelegate = new SampleMapDelegate ();
- map.Delegate = _mapDelegate;
+// _mapDelegate = new SampleMapDelegate ();
+// map.Delegate = _mapDelegate;
- //Example 2 - Using weak deleegate
- //map.WeakDelegate = this;
+ //Example 2 - Using weak delegate
+// map.WeakDelegate = this;
//Exmaple 3 - Using .NET event
- /*map.DidSelectAnnotationView += (s,e) => {
-
- var sampleAnnotation = e.View.Annotation as SampleMapAnnotation;
-
- if (sampleAnnotation != null) {
-
- //demo accessing the coordinate of the selected annotation to zoom in on it
- mapView.Region = MKCoordinateRegion.FromDistance (sampleAnnotation.Coordinate, 500, 500);
-
- //demo accessing the title of the selected annotation
- Console.WriteLine ("{0} was tapped", sampleAnnotation.Title);
- }
- };*/
+// map.DidSelectAnnotationView += (s,e) => {
+//
+// var sampleAnnotation = e.View.Annotation as SampleMapAnnotation;
+//
+// if (sampleAnnotation != null) {
+//
+// //demo accessing the coordinate of the selected annotation to zoom in on it
+// map.Region = MKCoordinateRegion.FromDistance (sampleAnnotation.Coordinate, 500, 500);
+//
+// //demo accessing the title of the selected annotation
+// Console.WriteLine ("{0} was tapped", sampleAnnotation.Title);
+// }
+// };
//an arbitrary coordinate used for demonstration here
var sampleCoordinate = new CLLocationCoordinate2D (42.3467512, -71.0969456);
@@ -56,20 +58,6 @@ public override void ViewDidLoad ()
//create an annotation and add it to the map
map.AddAnnotation (new SampleMapAnnotation (sampleCoordinate));
}
-
- public override void ViewDidUnload ()
- {
- base.ViewDidUnload ();
-
- // Release any retained subviews of the main view.
- // e.g. myOutlet = null;
- }
-
- public override bool ShouldAutorotateToInterfaceOrientation (UIInterfaceOrientation toInterfaceOrientation)
- {
- // Return true for supported orientations
- return (toInterfaceOrientation != UIInterfaceOrientation.PortraitUpsideDown);
- }
class SampleMapDelegate : MKMapViewDelegate
{
Please sign in to comment.
Something went wrong with that request. Please try again.