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); } }
void HandleTillingViewTouchUpInside (object sender, EventArgs e) { try { var tv = (TilingView)sender; selectedTV = tv; float left = tv.ParentFrame.Left - scrollView.ContentOffset.X; UpdatePosition (left, true); if (tv.Annotation != null) { GotoLocation (tv.Annotation.Coordinate); mapView.SelectAnnotation (tv.Annotation, true); } else { //TAKE PICTURE //this.DismissModalViewControllerAnimated(true); } } catch (Exception ex) { Util.LogException("HandleTillingViewTouchUpInside", ex); } }