DNAPhotoViewController NewPhotoViewController(NSPhoto photo) { if (photo != null) { UIView loadingView = null; if (((NSObject)Delegate).RespondsToSelector(new Selector("photosViewController:loadingViewForPhoto:"))) { loadingView = Delegate.LoadingViewForPhoto(this, photo); } var photoViewController = new DNAPhotoViewController(photo, loadingView, _notificationCenter); photoViewController.Delegate = this; SingleTapGestureRecognizer.RequireGestureRecognizerToFail(photoViewController.DoubleTapGestureRecognizer); if (((NSObject)Delegate).RespondsToSelector(new Selector("photosViewController:maximumZoomScaleForPhoto:"))) { var maximumZoomScale = Delegate.MaximumZoomScaleForPhoto(this, photo); photoViewController.ScalingImageView.MaximumZoomScale = maximumZoomScale; } return(photoViewController); } return(null); }
public void DidLongPressWithGestureRecognizer(DNAPhotoViewController photoViewController, UILongPressGestureRecognizer longPressGestureRecognizer) { ShouldHandleLongPress = false; bool clientDidHandle = false; if (((NSObject)Delegate).RespondsToSelector(new Selector("photosViewController:handleLongPressForPhoto:"))) { clientDidHandle = Delegate.HandleLongPressForPhoto(this, photoViewController.Photo, longPressGestureRecognizer); } ShouldHandleLongPress = !clientDidHandle; if (ShouldHandleLongPress) { var menuController = UIMenuController.SharedMenuController; var targetRect = CGRect.Empty; targetRect.Location = longPressGestureRecognizer.LocationInView(longPressGestureRecognizer.View); menuController.SetTargetRect(targetRect, longPressGestureRecognizer.View); menuController.SetMenuVisible(true, true); } }