public List <UIImageView> RestructureImages(List <UIImage> scrollImages) { try { nfloat h = 100.0f; nfloat w = 100.0f; nfloat padding = 10.0f; List <UIImageView> scrollImageCollection = new List <UIImageView> (); for (int i = 0; i < scrollImages.Count; i++) { UIImageView imageView = new UIImageView(); imageView.Frame = new CGRect(padding * (i + 1) + (i * w), 0, w, h); imageView.Image = scrollImages [i]; Action tapAction = new Action( delegate { imageView = HighlightSelectedImage(imageView); ImagePeviewViewController imagePreviewController = parentController.Storyboard.InstantiateViewController("ImagePeviewViewController") as ImagePeviewViewController; imagePreviewController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen; imagePreviewController.previewImage = imageView; parentController.PresentViewController(imagePreviewController, false, null); }); UITapGestureRecognizer tap = new UITapGestureRecognizer(); tap.AddTarget(tapAction); imageView.AddGestureRecognizer(tap); imageView.UserInteractionEnabled = true; scrollImageCollection.Add(imageView); } return(scrollImageCollection); } catch (Exception ex) { Debug.WriteLine("Exception Occured in RestructureImages method due to " + ex.Message); return(new List <UIImageView> ()); } }
private void tapGestureAction() { Action tapAction = new Action( delegate { { if (this.parentCell is PunchCell) { ImagePeviewViewController imagePreviewController = (this.parentCell as PunchCell).parentController.Storyboard.InstantiateViewController("ImagePeviewViewController") as ImagePeviewViewController; imagePreviewController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen; imagePreviewController.previewImage = ImageView; (this.parentCell as PunchCell).parentController.PresentViewController(imagePreviewController, false, null); } else if (this.parentCell is GuidedPhotoCell) { ImagePeviewViewController imagePreviewController = (this.parentCell as GuidedPhotoCell).parentController.Storyboard.InstantiateViewController("ImagePeviewViewController") as ImagePeviewViewController; imagePreviewController.ModalPresentationStyle = UIModalPresentationStyle.FullScreen; imagePreviewController.previewImage = ImageView; (this.parentCell as GuidedPhotoCell).parentController.PresentViewController(imagePreviewController, false, null); } } }); UITapGestureRecognizer tb = new UITapGestureRecognizer(); tb.AddTarget(tapAction); ImageView.AddGestureRecognizer(tb); }