-
StackOverflow 文档
-
Xamarin.iOS 教程
-
UIImageView 与 UIScrollView 结合使用
-
双击
private float minScale = 1f;
private float doubleTapScale = 2f;
private float maxScale = 4f;
private void SetUpDoubleTapZoom()
{
imageViewToZoom.ContentMode = UIViewContentMode.ScaleAspectFit;
scrollView.MaximumZoomScale = maxScale;
scrollView.MinimumZoomScale = minScale;
var doubleTap = new UITapGestureRecognizer(OnDoubleTap)
{
NumberOfTapsRequired = 2
};
scrollView.AddGestureRecognizer(doubleTap);
}
private void OnDoubleTap(UIGestureRecognizer gesture)
{
scrollView.ZoomScale = (scrollView.ZoomScale.Equals(minScale)) ? doubleTapScale : minScale;
}