Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/entity-framework/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
UIScrollView未以最小缩放开始_Uiscrollview_Xamarin.ios - Fatal编程技术网

UIScrollView未以最小缩放开始

UIScrollView未以最小缩放开始,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

我正在尝试让UIScrollView在我的Monotouch应用程序中工作。无论我将SetZoomScale()设置为什么,它总是忽略我的起始比率。理想情况下,我希望它在启动时缩放到0.5f

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
,以防止首次加载视图时图形动画化。这当然是偏好的问题