如何在iPhone 5中支持自定义图形 [英] how to support custom graphics in iPhone 5

查看:66
本文介绍了如何在iPhone 5中支持自定义图形的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在iPhone 5,4英寸显示器中支持自定义图形。

我知道对于默认它需要添加-568h前缀,当我的状态栏被隐藏并且我的背景图像大小时它会工作是640 x 1136像素。但是当我需要为尺寸小于1136像素的屏幕添加自定义背景时,它不起作用。

那么如何在新的视网膜显示器中支持自定义图形?

How to support custom graphics in iPhone 5, 4 inches display.
I know that for Default it's need to add -568h prefix and it's work when my status bar is hidden and my background image size is 640 x 1136 px. But when I need to add custom background for the screen that size smaller then 1136 px it doesn't work.
So how to support custom graphics in new retina display?

推荐答案

您可以使用我的三个 #define s:

You can use my three #defines:

#define isPhone568 ([[UIDevice currentDevice] userInterfaceIdiom] == UIUserInterfaceIdiomPhone && [UIScreen mainScreen].bounds.size.height == 568)
#define iPhone568ImageNamed(image) (isPhone568 ? [NSString stringWithFormat:@"%@-568h", image] : image)
#define iPhone568Image(image) ([UIImage imageNamed:iPhone568ImageNamed(image)])

只需给你的图像-568h@2x.png表示法,并使用 iPhone568ImageNamed 获取标准名称或iPhone 5 /新iPod的名称。

Just give your images the -568h@2x.png notation, and use iPhone568ImageNamed to get a name for standard name or iPhone 5/new iPod.

这篇关于如何在iPhone 5中支持自定义图形的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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