[英]Issue with displaying the image correctly in iPhone(3.5 retina inch)
I have to display the same image in iPhone and iPhone(3.5 retina inch). 我必须在iPhone和iPhone(3.5英寸视网膜)上显示相同的图像。 But it appears differently.
但是看起来却有所不同。
The original image looks like this: 原始图像如下所示:
It runs correctly in iPhone but it doesn't run correctly in iPhone(3.5 retina inch). 它可以在iPhone中正常运行,但不能在iPhone(3.5英寸视网膜)上正常运行。 In iPhone(3.5 retina inch), it appears like this:
在iPhone(3.5英寸视网膜)上,它看起来像这样:
I have tried this: 我已经试过了:
imageView.contentMode = UIViewContentModeScaleToFill;
The whole code looks like this: 整个代码如下所示:
if(IS_IPHONE_5)
{
// code for 4-inch screen
backgroundImageView.frame = CGRectMake(0, 0, 320, 460);
backgroundImageView.image = [UIImage imageNamed:@"image1_iphone5.png"];
} else {
// code for 3.5-inch screen
backgroundImageView.frame = CGRectMake(0, 0, 320, 370);
backgroundImageView.contentMode = UIViewContentModeScaleToFill;
[backgroundImageView setImage:[UIImage imageNamed:@"image1.png"]];
}
but this doesn't solve the problem. 但这不能解决问题。 Have been stuck with this issue for a day.
已经被这个问题困扰了一天。 Not sure what the problem is.
不确定是什么问题。 Really need some guidance.
确实需要一些指导。
If you have one image for 4-inch and 3.5-inch devices the problem is probably in autoresizing mask, looks like now you have UIViewAutoresizingFlexibleHeight on. 如果您有一张用于4英寸和3.5英寸设备的图像,则问题可能出在自动调整蒙版大小上,看起来现在您已启用UIViewAutoresizingFlexibleHeight。 Try setting UIViewAutoresizingNone instead.
尝试改为设置UIViewAutoresizingNone。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.