简体   繁体   English

UIImageView正在调整大小

[英]UIImageView is resizing

I have an issue with uiimageviews resizing at run time. 我在运行时调整uiimageviews大小时遇到​​问题。 On one view I have more than a dozen uiimageviews contained within a uiscrollview. 在一个视图中,我在uiscrollview中包含了十几个uiimageviews。 The images are assigned at design time. 图像在设计时分配。 The uiimageview's are all the same size. uiimageview的大小都相同。 The mode is set to Aspect Fill for all uiimageviews. 所有uiimageviews的模式都设置为Aspect Aspect。 At run time the images appear correctly in the view. 在运行时,图像会正确显示在视图中。

On a second view I have only 9 uiimageviews. 在第二个视图上,我只有9个uiimageviews。 These uiimageviews will display up to nine of the images selected from the first view. 这些uiimageviews最多可以显示从第一个视图中选择的九个图像。 There are three images across and three images down. 共有三幅图像,三幅图像向下。 The uiimageview at design time is the same size as on the first view. 设计时的uiimageview与第一个视图的大小相同。 The uiimageview image is assigned an image that is loaded into an array. uiimageview图像分配有一个图像,该图像已加载到数组中。 All the uiimageviews are sized the same and they also have the mode set to Aspect Fill. 所有uiimageviews的大小都相同,并且它们的模式都已设置为Aspect Fill。 The images are assigned at run time using image1.image = xxx. 在运行时使用image1.image = xxx分配图像。 Where xxx is an image stored in an array. 其中xxx是存储在数组中的图像。

However, on this second view, the images are not all the same size. 但是,在第二个视图上,图像的大小并非全部相同。 The height of the image changes dynamically. 图像的高度动态变化。 The same image displayed in a different uiimageview on the view will be different sizes. 在视图上的不同uiimageview中显示的同一图像将具有不同的大小。 It is the height of the uiimageview that changes. uiimageview的高度会发生变化。 In some cases the image will fill the uiimageview differently. 在某些情况下,图像将以不同的方式填充uiimageview。 It is like the mode changes dynamically. 就像模式动态变化一样。

I've tried using different modes and nothing changes. 我尝试使用不同的模式,并且没有任何变化。

Any ideas on what is happening? 有什么想法吗?

设置图像属性后,尝试重置UIImageview对象的框架(与设计时设置的大小相同)...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM