UIScrollView未以最小缩放开始
我正在尝试让UIScrollView在我的Monotouch应用程序中工作。无论我将SetZoomScale()设置为什么,它总是忽略我的起始比率。理想情况下,我希望它在启动时缩放到0.5fUIScrollView未以最小缩放开始,uiscrollview,xamarin.ios,Uiscrollview,Xamarin.ios,我正在尝试让UIScrollView在我的Monotouch应用程序中工作。无论我将SetZoomScale()设置为什么,它总是忽略我的起始比率。理想情况下,我希望它在启动时缩放到0.5f theGraphScrollView = new UIScrollView(theRect); // Half of the screen height, full width of screen this.View.AddSubview(theGraphScrollView); UIImageView
theGraphScrollView = new UIScrollView(theRect); // Half of the screen height, full width of screen
this.View.AddSubview(theGraphScrollView);
UIImageView imageView = new UIImageView(thePhotoSource.LoadPhotoFromFile("IMG_0_17.JPG"));
theGraphScrollView.ContentSize = imageView.Image.Size; // This is much bigger than the screen width and height.
theGraphScrollView.MaximumZoomScale = 3f;
theGraphScrollView.MinimumZoomScale = 0.5f;
theGraphScrollView.SetZoomScale(0.5f, true);
theGraphScrollView.AddSubview(imageView);
theGraphScrollView.ViewForZoomingInScrollView += (UIScrollView sv) => { return imageView; };
谁能告诉我哪里出了问题
非常感谢。最后需要
SetZoomScale()
ViewForZoomingInScrollView
应在更改缩放之前连接好。最后需要设置ZoomScale()
更改缩放之前,应先连接用于缩放的视图CrollView。通过调用
设置ZoomScale
,尝试设置视图动画,但您既没有添加图像,也没有将代理设置为通知图形CrollView
要缩放的视图
将
SetZoomScale
移动到最后,您将被设置。如果这是在viewdiload
中,您可能还希望将SetZoomScale
的第二个参数设置为false
,以防止首次加载视图时图形动画化。当然,这是一个偏好问题。通过调用SetZoomScale
,尝试设置视图动画,但您既没有添加图像,也没有设置代理通知GraphScrollView
要缩放的视图
将SetZoomScale
移动到最后,您将被设置。如果这是在viewdiload
中,您可能还希望将SetZoomScale
的第二个参数设置为false
,以防止首次加载视图时图形动画化。这当然是偏好的问题