private void AddImageWithName (ImageInfo imageInfo) { try { int position = imageInfo.Index; var view = new UIView () { ContentMode = UIViewContentMode.Center, Frame = new RectangleF ((position - 1) * w, (h - 75) / 2, w, h), }; Image img = imageInfo.Img; var tilingView = new TilingView (img, new SizeF (75, 75)) { ParentFrame = view.Frame, }; tilingView.ParentHolder = view; tilingView.TouchUpInside += HandleTillingViewTouchUpInside; if (img != null) { string title = img.Name ?? "No title"; var location = new CLLocationCoordinate2D (img.Latitude, img.Longitude); var a = new MyAnnotation (location, title, "Evenement") { TV = tilingView, AssocImage = img, }; a.OnAnnotationClicked += AnnotationClicked; mapView.AddAnnotationObject (a); tilingView.Annotation = a; } view.AddSubview (tilingView); scrollView.AddSubview (view); tillingViews.Add(tilingView); photosViews.Add(view); } catch(Exception ex) { Util.LogException("AddImageWithName", ex); } }
private void AnnotationClicked (MyAnnotation a) { try { scrollView.ScrollRectToVisible (new RectangleF (a.TV.ParentFrame.Left, 0, w, h), false); float left = a.TV.ParentFrame.Left - scrollView.ContentOffset.X; UpdatePosition (left, true); //a.TV.Layer.BackgroundColor = UIColor.Black.CGColor; //a.TV.SetNeedsDisplay(); } catch (Exception ex) { Util.LogException("AnnotationClicked", ex); } }