public override void DidSelectAnnotationView(MapKit.MKMapView mapView, MapKit.MKAnnotationView view) { selected = view.Annotation as MapKit.MKPointAnnotation; if (selected != null) { mapView.SetRegion(new MapKit.MKCoordinateRegion(new CoreLocation.CLLocationCoordinate2D(selected.Coordinate.Latitude, selected.Coordinate.Longitude), new MapKit.MKCoordinateSpan(30, 30)), true); foreach (var cell in tableView.VisibleCells) { if (selected.Title == cell.TextLabel.Text) { //tableView.SelectRow(tablerow,true,0 ); cell.Selected = true; //cell.Accesory } else { cell.Selected = false; } } } //Foundation.NSIndexPath tablerow = new Foundation.NSIndexPath(); //tablerow= //tableSource.FindRow(selected.Title); //tableView.SelectRow(tablerow,true,0 ); //UITableViewDataSource.SectionIndex }
//handle case where no answer selected!!!!!!!!!!!!!!!!!!! public override void PrepareForSegue(UIStoryboardSegue segue, NSObject sender) { base.PrepareForSegue(segue, sender); if (segue.Identifier == "HomeSegue") { answers.Clear(); choices.Clear(); } else { var source = GameMap.Delegate as MapActions; MapKit.MKPointAnnotation selection = source.GetSelection(); if (selection != null) { choices.Add(options[selection.Title]); } if (segue.Identifier == "FinalSegue" && base.ShouldPerformSegue("FinalSegue", sender)) { var scorepage = segue.DestinationViewController as ScorePage; if (scorepage != null) { scorepage.choices = choices; scorepage.answers = answers; } } else { if (base.ShouldPerformSegue("NextSegue", sender)) { var gamecontroller = segue.DestinationViewController as GameController1; if (gamecontroller != null) { gamecontroller.Rounds = Rounds; gamecontroller.currenRound = currenRound + 1; gamecontroller.answers = answers; gamecontroller.choices = choices; } } } } }
public override bool ShouldPerformSegue(string segueIdentifier, NSObject sender) { //return base.ShouldPerformSegue(segueIdentifier, sender); if (segueIdentifier == "FinalSegue" || segueIdentifier == "NextSegue") { var source = GameMap.Delegate as MapActions; MapKit.MKPointAnnotation selection = source.GetSelection(); if (selection != null) { return(true); } else { return(false); } } else { return(true); } }