[Export("tableView:didSelectRowAtIndexPath:")] //DismissKeyboard() would block it public virtual void RowSelected(UIKit.UITableView tableView, Foundation.NSIndexPath indexPath) { if (indexPath.Row != selectedPos) { locationList[selectedPos].isSelected = false; locationList[indexPath.Row].isSelected = true; selectedPos = indexPath.Row; CLLocationCoordinate2D location = new CLLocationCoordinate2D(locationList[indexPath.Row].latitude, locationList[indexPath.Row].longitude); MoveMap(location, false); AddCircle(location); } else { if (locationList[selectedPos].isSelected == false) { locationList[selectedPos].isSelected = true; CLLocationCoordinate2D location = new CLLocationCoordinate2D(locationList[indexPath.Row].latitude, locationList[indexPath.Row].longitude); MoveMap(location, false); AddCircle(location); } else { locationList[selectedPos].isSelected = false; if (!(circle is null)) { LocationHistoryMap.RemoveAnnotation(circle); } } } LocationHistoryList.ReloadData(); }
private void AddCircle(CLLocationCoordinate2D location) { if (!(circle is null)) { LocationHistoryMap.RemoveAnnotation(circle); } circle = new MKPointAnnotation() { Title = "Center", Coordinate = location }; LocationHistoryMap.AddAnnotation(circle); }