简体   繁体   English

在iPhone(3.5英寸视网膜)上正确显示图像的问题

[英]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.

相关问题 我的按钮在iPhone(4英寸视网膜)模拟器上未检测到触摸事件,但在iPhone(3.5英寸视网膜)模拟器中有效 - My button doesn't detect touch events on iPhone (Retina 4-inch) simulator, but works in iPhone (Retina 3.5-inch) simulator 为什么我的Xcode4.5没有iPhone(Retina 4英寸)和iPhone(Retina 3.5英寸) - Why my Xcode4.5 doesn't has iPhone(Retina 4-inch) and iPhone(Retina 3.5inch) 提取联系人在iPhone Retina 4英寸64位模拟器中不起作用,但在3.5英寸中可以正常工作 - Fetching contact is not working in iphone retina 4inch 64bit simulator but works fine in 3.5 inch iPhone模拟器不再正确显示4英寸显示屏 - iPhone simulator no longer displaying 4 inch display correctly 4英寸发射图像视网膜不能在iphone4发射图像中工作 - 4inch launch image retina not working in iphone4 launch image Retina 4英寸应用程序,也可在3.5上工作 - Retina 4 inch app, to also work on 3.5 笔尖兼容iPhone 3.5英寸和4英寸 - nib compatible for iPhone 3.5 inch and 4 inch iPhone 3.5英寸屏幕 - 4英寸屏幕: - iPhone 3.5 Inch screen - 4 inch screen: 在3.5英寸和4英寸iPhone屏幕上同时显示图像时,如何使图像居中? - How can I center a image when it is displayed in both 3.5 inch and 4 inch iphone screen? iOS 7.0及更高版本:3.5视网膜iPhone的图像大小 - iOS 7.0 and up: Image size for 3.5 retina iPhone
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM