private void AddPinToMapWithVenue(NCVenue venue, UIImage image) { double xPoint = venue.X.DoubleValue * mapView.Width() / currentSublocation.Width; double yPoint = mapView.Height() * (1 - venue.Y.DoubleValue / currentSublocation.Height); CGPoint point = new CGPoint(xPoint, yPoint); VenueMapPin mapPin = new VenueMapPin(venue); mapPin.SetImage(image, UIControlState.Normal); mapPin.SetImage(image, UIControlState.Highlighted); mapPin.AddTarget(MapPinPressed, UIControlEvent.TouchUpInside); mapPin.SizeToFit(); mapView.AddSubview(mapPin); scrollView.BringSubviewToFront(mapPin); mapPin.Center = point; }
private void MapPinPressed(object sender, EventArgs e) { VenueMapPin mapPin = (VenueMapPin)sender; if (pressedPin != null) { pressedPin.PopUp.RemoveFromSuperview(); pressedPin.PopUp.Hidden = true; } pressedPin = mapPin; mapView.AddSubview(mapPin.PopUp); mapPin.PopUp.Hidden = false; mapPin.PopUp.SetBottom(mapPin.Top() - 9.0f); mapPin.PopUp.SetCenterX(mapPin.CenterX()); mapPin.PopUp.AddTarget(PopUpPressed, UIControlEvent.TouchUpInside); }