简体   繁体   English

在iOS中将图像从纵向调整为横向模式

[英]Resize images from portrait to landscape mode in iOS

What is the best way to resize images from portrait to landscape view? 从纵向到横向调整图像大小的最佳方法是什么?

The best way is to change the image when you turn the device? 最好的方法是在打开设备时更改图像? or use the coordinates of autosizing in IB? 还是在IB中使用自动调整的坐标?

thanks for all! 谢谢大家!

Best regards 最好的祝福

You need to add autoresizing mask to your image view like this 您需要像这样向图像视图添加自动调整大小的蒙版

UIImageView *imageView = [[UIImageView alloc]initWithFrame:self.view.frame];
imageView.contentMode = UIViewContentModeScaleAspectFill;
imageView.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[self.view addSubview:imageView];
[imageView release];

I don't know what's the best way. 我不知道什么是最好的方法。 I do like this 我喜欢这样

imageView.autoresizingMask = UIViewAutoresizingFlexibleTopMargin | UIViewAutoresizingFlexibleBottomMargin | UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleRightMargin;

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

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