diff --git a/Todo11/Todo11/MapViewController.cs b/Todo11/Todo11/MapViewController.cs index 75f3c5e..7968abc 100644 --- a/Todo11/Todo11/MapViewController.cs +++ b/Todo11/Todo11/MapViewController.cs @@ -39,6 +39,7 @@ public override void ViewDidLoad() View.AddSubview(CloseButton); Map.ShowsUserLocation = true; + Map.ShowsCompass = true; Map.AddGestureRecognizer((longPressGestureRecognizer = new UILongPressGestureRecognizer(OnMapLongPress))); doubleTapGestureRecognizer = new UITapGestureRecognizer() { NumberOfTapsRequired = 2 }; @@ -51,14 +52,14 @@ public override void ViewDidLoad() Map.AddGestureRecognizer(doubleTapGestureRecognizer); - Map.DidUpdateUserLocation += (sender, e) => { - if (Map.UserLocation != null) - { - CLLocationCoordinate2D coords = Map.UserLocation.Coordinate; - MKCoordinateSpan span = new MKCoordinateSpan(MilesToLatitudeDegrees(2), MilesToLongitudeDegrees(2, coords.Latitude)); - Map.Region = new MKCoordinateRegion(coords, span); - } - }; + //Map.DidUpdateUserLocation += (sender, e) => { + // if (Map.UserLocation != null) + // { + // CLLocationCoordinate2D coords = Map.UserLocation.Coordinate; + // MKCoordinateSpan span = new MKCoordinateSpan(MilesToLatitudeDegrees(2), MilesToLongitudeDegrees(2, coords.Latitude)); + // Map.Region = new MKCoordinateRegion(coords, span); + // } + //}; if (Map.UserLocation != null) { CLLocationCoordinate2D coords = Map.UserLocation.Coordinate; diff --git a/Todo11/Todo11/TableViewController+Drop.cs b/Todo11/Todo11/TableViewController+Drop.cs index 4389eae..3e4e06d 100644 --- a/Todo11/Todo11/TableViewController+Drop.cs +++ b/Todo11/Todo11/TableViewController+Drop.cs @@ -14,7 +14,6 @@ public partial class TableViewController : IUITableViewDropDelegate /// /// Ensure that the drop session contains a drag item with a data representation that the view can consume. /// - [Export("tableView:canHandleDropSession:")] public bool CanHandleDropSession(UITableView tableView, IUIDropSession session) { return session.CanLoadObjects(typeof(NSString)); @@ -22,14 +21,13 @@ public bool CanHandleDropSession(UITableView tableView, IUIDropSession session) /// /// A drop proposal from a table view includes two items: a drop operation, - /// typically .move or .copy; and an intent, which declares the action the + /// typically Move or Copy; and an intent, which declares the action the /// table view will take upon receiving the items. (A drop proposal from a /// custom view does includes only a drop operation, not an intent.) /// - [Export("tableView:dropSessionDidUpdate:withDestinationIndexPath:")] public UITableViewDropProposal DropSessionDidUpdate(UITableView tableView, IUIDropSession session, NSIndexPath destinationIndexPath) { - // The .move operation is available only for dragging within a single app. + // The Move operation is available only for dragging within a single app. if (tableView.HasActiveDrag) { if (session.Items.Length > 1) @@ -87,12 +85,13 @@ public void PerformDrop(UITableView tableView, IUITableViewDropCoordinator coord for (var j = 0; j < stringItems.Count; j++) { var indexPath1 = NSIndexPath.FromRowSection(destinationIndexPath.Row + j, 0); - + // update backing data InsertTodo(new TodoItem { Name = stringItems[j] }, destinationIndexPath.Row); - todoItems = AppDelegate.Current.TodoMgr.GetOrderedTodos().ToList(); indexPaths.Add(indexPath1); } + todoItems = AppDelegate.Current.TodoMgr.GetOrderedTodos().ToList(); + // animate table view to match if (indexPaths.Count > 0 && indexPaths.Count == stringItems.Count) { tableView.InsertRows(indexPaths.ToArray(), UITableViewRowAnimation.Automatic); diff --git a/Todo11/Todo11/TableViewController+Search.cs b/Todo11/Todo11/TableViewController+Search.cs index e8c8fea..c656e9a 100644 --- a/Todo11/Todo11/TableViewController+Search.cs +++ b/Todo11/Todo11/TableViewController+Search.cs @@ -15,8 +15,9 @@ void ConfigureSearch() DimsBackgroundDuringPresentation = false }; search.SearchResultsUpdater = this; // implemented the interface above - DefinesPresentationContext = true; // IMPORTANT: ensures segue works NavigationItem.SearchController = search; + + DefinesPresentationContext = true; // IMPORTANT: ensures segue works } public void UpdateSearchResultsForSearchController(UISearchController searchController) diff --git a/Todo11/Todo11/TableViewController.cs b/Todo11/Todo11/TableViewController.cs index 96b3faa..4649288 100644 --- a/Todo11/Todo11/TableViewController.cs +++ b/Todo11/Todo11/TableViewController.cs @@ -1,10 +1,9 @@ -using Foundation; using System; -using UIKit; using System.Collections.Generic; using System.Linq; -using CoreGraphics; using CoreLocation; +using Foundation; +using UIKit; namespace Todo11App { @@ -26,6 +25,15 @@ public override void ViewDidLoad() { base.ViewDidLoad(); + // Impelement delegate and datasource for tableview to operate + TableView.DataSource = this; + TableView.Delegate = this; + + // for Drag and Drop + TableView.DragDelegate = this; + TableView.DropDelegate = this; + + AddButton.Clicked += (sender, e) => { CreateTodo(); @@ -65,14 +73,6 @@ public override void ViewDidLoad() }; NavigationController.View.AddSubview(MapButton); - // Impelement delegate and datasource for tableview to operate - TableView.DataSource = this; - TableView.Delegate = this; - - // for Drag and Drop - TableView.DragDelegate = this; - TableView.DropDelegate = this; - // for 3DTouch if (TraitCollection.ForceTouchCapability == UIForceTouchCapability.Available) {