xcode 6资产目录iphone 6 [英] xcode 6 asset catalog iphone 6

查看:163
本文介绍了xcode 6资产目录iphone 6的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这个问题仍然没有得到解答。使用资产目录时,设备特定(非通用),选项为1x,2x,r 2x,3x。 1x是不必要的,因为它不是视网膜。 2x是ip4的好处,res为640x960。 r 2x是ip5的好处,res为640x1136。 3x是ip6plus,分辨率为1242x2208。

this problem still hasn't been answered. when using the asset catalog, device specific (not universal), the options are 1x, 2x, r 2x, 3x. 1x is unnecessary as it is not retina. 2x is the well for ip4 with a res 640x960. r 2x is the well for ip5 with a res 640x1136. 3x is the ip6plus well with a res of 1242x2208.

现在当我运行ip6的模拟器(不是ip6plus!)时,它使用2x图像(640x960 res用于ip4并且它也没有升级来填充屏幕(由于比率不适合,这无论如何都没有意义)。

now when i run the simulator for ip6 (not ip6plus!), it uses the 2x image (640x960 res for ip4) and it is also not upscaling to fill the screen (which wouldn't make sense anyhow as the ratios don't fit).

是否有人找到了为新手机设置背景图片的正确指南?我并不是说各种res大小如何缩放的解释,这是明确的,但如何解决xcassets图像与@2x共享ip4和ip6之间明显不匹配的问题?谢谢!

has anyone found a proper guide for setting up background images for the new phones? i don't mean the explanation how the various res sizes are scaling, that's clear, but how to work around the obvious mismatch between the xcassets image well @2x that shares ip4 and ip6? thanks!

编辑: Xcode资产目录支持3.5,4和4.7 @ 2x图像?类似的问题,但没有真正解决,只是通过使用通用而不是设备特定的解决方法。有人知道更好的方法吗?

edit: Xcode asset catalog support for 3.5", 4", and 4.7" @2x images? similar question but not really solved, just a workaround by using universal instead of device specific. anyone know a better way?

推荐答案

自2014年11月中旬以来,我已经向Apple报告了一个关于此问题的错误,我刚注意到它们已标记出来了它没有价值......这给了我的印象Apple已经故意省略了iPhone 6的额外插槽。我猜他们现在想要将2x插槽用于iPhone 6,也许他们正在减少对iPhone 4s的支持,因为它已经老了。

I have reported a bug to Apple about this since mid November 2014 and I just noticed they marked it as No Value... which gives me the impression Apple has omitted an additional slot for iPhone 6 on purpose. My guess is they now want the 2x slot to be used for iPhone 6, and maybe they're reducing support for iPhone 4s as it's getting old.

如果你真的想要为了继续支持iPhone 4s,我建议在2x插槽中使用iPhone 6大小的图像,然后使用以下方法加载你的图像:

If you really want to keep supporting the iPhone 4s, I'd suggest to use iPhone 6 sized images in the 2x slot, and then use the following method to load your images:

+(UIImage *)loadImageNamed:(NSString *)imageName
{
    CGSize screenSize = [UIScreen mainScreen].bounds.size;
    CGFloat screenHeight = MAX(screenSize.width, screenSize.height);
    CGFloat const IPHONE_4_SCREEN_HEIGHT = 480;
    UIImage *image = [UIImage imageNamed:imageName];
    if(screenHeight == IPHONE_4_SCREEN_HEIGHT) {
        CGFloat const xScale = .85333333;//x conversion ratio from iPhone 6's 375 pts width screen to iPhone 4's 320 pts width screen
        CGFloat const yScale = .71964018;//y conversion ratio from iPhone 6's 667 pts height screen to iPhone 4's 480 pts height screen
        CGSize newSize = CGSizeMake(xScale * image.size.width, yScale * image.size.height);
        UIGraphicsBeginImageContextWithOptions(newSize, NO, 0);

        [image drawInRect:(CGRect){0, 0, newSize}];
        UIImage *resizedImage = UIGraphicsGetImageFromCurrentImageContext();
        UIGraphicsEndImageContext();
        return resizedImage;
    }
    return image;
}

将大图像(iPhone 6)调整为较小的图像(iPhone 4s)即使纵横比不相同也不会损失很多质量。

Resizing a big image (iPhone 6) to a smaller one (iPhone 4s) doesn't lose much quality even if the aspect ration is not the same.

编辑:

这是Apple Relations对我的错误报告的回答:

This is Apple Relations answer to my bug report:


没有计划根据以下内容解决这个问题:

There are no plans to address this based on the following:

我们在IB中引入了大小类。因此,我们希望开发人员使用
XIB和图像视图来控制图像的加载方式并显示
。如果他们绝对必须为所有可能的屏幕尺寸提供像素
的完美图像,那么他们需要像你建议的那样做
,并确定加载自己的特定资源

We introduced size classes in IB. As such, we want developers to use an XIB with an image view that controls how an image is loaded and displayed. In the event that they absolutely must provided pixel perfect images for all possible screen sizes, then they need to do something like what you suggested and determine the specific resources to load themselves.

我们现在关闭此报告。

如果您对分辨率有疑问,或者这仍然是
关键问题,请使用
信息更新您的错误报告。

If you have questions about the resolution, or if this is still a critical issue for you, then please update your bug report with that information.

请务必定期检查新的Apple版本是否有任何更新
可能会影响此问题。

Please be sure to regularly check new Apple releases for any updates that might affect this issue.

这篇关于xcode 6资产目录iphone 6的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆