我的图像很少,我想在iPad上全屏显示?

时间:2011-11-04 05:37:19

标签: ipad uiimageview

我的图像很少,我希望在全屏显示在iPad上 - 使用相同的图像。和图像大小不一样。有没有办法以编程方式拉伸图像(UIImageView)

谢谢

1 个答案:

答案 0 :(得分:0)

要在UIImageView范围内拉伸图像,您只需设置相应的contentMode。

您可以将UIImageView设置为屏幕大小,并设置内容模式,如下所示

3个选项

// assume iv is an UIImageView the size of screen
// First option stretches your image to the size of the screen
[iv setContentMode:UIViewContentModeScaleToFill];
// Second option scales your image without changing aspect ratio to the largest possible size such that the whole image fits
[iv setContentMode:UIViewContentModeScaleAspectFit];
// Third option scales your image without changing aspect ratio to the smallest possible size such that the screen is covered (potentially clipping some of your image)
[iv setContentMode:UIViewContentModeScaleAspectFill];