1

I just started using Auto Layout for my upcoming projects. I created an UIImageView inside a UIScrollView like shown in the image below:

UIScrollView with UIImageView

Auto Layout works as expected and positions the UImageView correctly after rotation. My problem is that I want the UIImageView to stretch in Landscape Mode so that it fills the whole width. How can I do that? At the moment it has the same size as in Portrait Mode.

When I place the UIImageView directly in the UIViewControllers View without using an UIScrollView it stretches correctly. Why is that? I would be happy for some hints.

I am using the following constraints (Leading and Trailing Space are equal 0): Constraints

4

1 回答 1

0

好的,我发现使用自动布局时,UIImageView 总是继承其 UIImage 的大小。因此,如果我在旋转时更改图像, UIImageView 只会正确调整大小。

于 2013-04-20T12:08:49.680 回答