`
zani
  • 浏览: 348973 次
  • 性别: Icon_minigender_1
  • 来自: 福州
社区版块
存档分类
最新评论

iphone4 xxx@2.png图片作用和如何使用

 
阅读更多

The retinal display on the new iPhone 4 doubles the pixel resolution of the display. However when it comes to laying out the UI elements you can still think about a full screen display with dimensions of 320 x 480 in portrait mode. The big difference is that these dimensions are now expressed in points NOT pixels. What has changed is the scaling factor of the screen which determines how a point relates to a pixel. For the iPhone 4 the display has a scale of 2 so that 1 point = 2 pixels.

The number of pixels on the display has doubled to 640 x 960 but if you are using UIKit this added complexity is mostly hidden from the application. The UI layout is configured using the point dimensions so thankfully you do not have to worry about redoing the layout just for iPhone 4 devices. Also things like text and standard Apple UI components such as navigation bars, system buttons, etc are automatically displayed at the higher pixel resolution. Note that if you are using core graphics or core animation you will have some additional work to do as those frameworks only work with pixels not points.

There are some additional steps that are worth doing if you want your app to look its best on the iPhone 4.

2x Image Files

Apple has introduced a simple naming convention to allow image files at double the resolution to be loaded when the display will support it. To make use of this feature you need to go back to your original image files and create versions at twice the existing size. So if you have an image that is currently 100x100 pixels named myImage.png you need to create a new version which is 200x200 pixels named myImage@2x.png.

You should probably avoid just taking the existing image file and scaling it up to double the size. Ideally you want to create your images at the higher resolution and then scale down to the standard resolution so that both sizes look their best.

Once you have the high-resolution image files you just need to add them to your project and they will be selected automatically anytime you use UIImage class methods such as +imageNamed: or +imageWithContentsOfFile: So for example:

UIImage *myImage = [UIImage imageNamed:@”myImage.png”];

 

will load myImage.png on iPhone 3 and iPad devices but will load myImage@2x.png on the iPhone 4. It is possible to omit the filename extension from the name of the image file with iOS 4 but you will need to include it if you want to maintain compatibility with 3.x releases.

Applications Icons

As well as updating image files you should also update the application icon files to include high-resolution versions of each file. So since the original iPhone application icon file is 57x57 pixels the 2x version needs to be 114x114 pixels. In addition the settings/search icon which is normally 29x29 pixels needs a high-resolution version that is 58x58 pixels.

With iPhone OS 3.2 for the IPad a new key (CFBundleIconFiles) was introduced to Info.plist to specify the ever growing list of icon files. If you are producing an App that will only run only on iOS 4.0 and 3.2 you can use CFBundleIconFiles (you can delete the old CFBundleIconFile key if you want since it will no longer be used).

If you do not specify the filename extensions you can avoid listing all of the 2x variations of the file. So if we have an iPhone icon, an IPad icon and the corresponding settings/search icons the entry in Info.plist would be as follows:

If we want to maintain compatibility with pre-3.2 devices we cannot rely on the CFBundleIconFiles key. Instead we need to specify the icon files using the Apple determined naming convention. The files we would need to support all devices would be as follows:

  • Icon.png - 57x57 pixels application icon for standard resolution iPhone
  • Icon@2x.png - 114x114 pixels application icon for high resolution iPhone 4
  • Icon-72.png - 72x72 pixels application icon for iPad
  • Icon-Small.png - 29x29 pixels settings icon for standard resolution iPhone
  • Icon-Small@2x.png - 58x58 pixels settings icon for high resolution iPhone
  • Icon-Small-50.png - 50x50 pixels settings icon for iPad

Then in the Info.plist file we need to use the original CFBundleIconFile key to specify just the basename of the icon file (“Icon.png”) as follows:

Launch Images

As with the application icons you can also specify high-resolution versions of your launch images. So a standard resolution portrait launch image named Launch.png is 320x480 pixels. The high resolution version would be 640x960 pixels and named Launch@2x.png.

Likewise a landscape version of the file named Default-Landscape.png would be 480x320 in standard resolution (assuming a status bar) and named Default-Landscape@2x.png with 960x640 pixels in high resolution.

分享到:
评论

相关推荐

    xxx@xxx.com

    lorem ipsm dolor sit amet

    XXX平台1.01.1版本登录流程图.png

    XXX平台1.01.1版本登录流程图.png

    c# Email 邮件发送工具

    基于 System.Web.Mail 与 System.Net.Mai 实现的EmailClient,展示了两种不同命名空间下的mail发送区别与使用方式,并提供了统一的帮助类处理邮件发送。 邮件异步发送示例: EmailHelper.SendNetMailAsync(new ...

    STM32F10xxx参考手册.zip

    STM32F10xxx参考手册.zipSTM32F10xxx参考手册.zipSTM32F10xxx参考手册.zipSTM32F10xxx参考手册.zipSTM32F10xxx参考手册.zipSTM32F10xxx参考手册.zipSTM32F10xxx参考手册.zipSTM32F10xxx参考手册.zipSTM32F10xxx参考...

    XXX.rar_H XXX_XXX.www._https://cn.txxx.com_wwwxxxex_xxxwww.98

    信号处理入门级程序,包含了数据采集,频谱分析等

    封装好的java邮件包

    mailInfo.setPassword("xxx"); mailInfo.setContentType("text/html"); mailInfo.setContent("<font color=\"red\">welcome to </font><a >技术社区</a>"); sendMail=new FinderSendMail(mailInfo); ...

    电子邮件的基础知识 smtp协议

    基本命令 1、HELO HELO hostname 从客户端打开问候信息,使用SMTP服务器识别客户机的身份。但客户机 ...2、MAIL 标识发件人,MAIL FROM:XXX@EXAMPLE.COM 3、RCPT 标识收件人,RCPT TO:XXX@EXAMPLE.COM

    xxx.rar_xxx video_xxx.CBp.VDO_xxx.video._视频 解压缩

    视频图像的编解码,将原始图像压缩成MPEG4格式,然后在客户端解压缩显示

    asp邮件统计系统 v1.0.rar

    1,在配合asp邮件群发系统 v3.3个性群发使用 添加图片可自定义图片大小 2,{mail} 是需要替换成你用统计的邮箱地址 例如 tj.asp?t=xxx@163.com 以图片方式调用当xxx@163.com查看邮件的时候你就可以看见他的IP地址打开...

    mailSender_v1.0.jar (For Android platform)

    基于Android平台的Mail Sender. 代码示例: 1.普通邮件: ... ... …… private void testJMailSender(){ ... String password = "xxx";... String to = "xxx@sina.com";...如使用有问题,请联系QQ:28185776

    sketch-9patch:一个Sketch插件,可将选定的画板转换为9patch布局,然后将其导出到Desktop上的xxx.9.png

    该Sketch插件会将选定的画板转换为9patch布局,然后将其导出到Desktop上的xxx.9.png。 如何使用: 将图层放置在画板上。 每个画板将导出一个PNG文件。 根据需要重命名画板,而无需添加“ .9”或“ .9.png”。 ...

    Android开发email

    通过第三方库开发Email,内包含activation.jar、additionnal.jar、mail.jar三个开发Jar包和封装调用方法,以及使用示例。 final EmailSender email = new EmailSender.Builder() .host("smtp.163.com") .port("25...

    工作流程:基于laravel的工作流项目

    初始帐户: 1@qq.com 2@qq.com 3@qq.com 4@qq.com 5@qq.com 6@qq.com 7@qq.com 8@qq.com 9@qq.com 10@qq.com 密码统一为:123456 邮件发送配置(qq为例) MAIL_DRIVER=smtp MAIL_HOST=smtp.qq.com MAIL_PORT=465 ...

    TMS320F28335 DSP28xxx_SysCtrl.c

    TMS320F28335 DSP28xxx_SysCtrl.c TMS320F28335 DSP28xxx_SysCtrl.c

    PHP MSN Class v1.9.rar

    PHP MSN Class,支持MSNP9 (MSN 6.2)和最新的MSNP15 (WLM 8.1)协议(MSNP15协议支持离线消息),可以作为MSN机器人使用,或者给MSN、雅虎通发消息。 示例代码: include_once('msn.class.php'); $msn_username...

    服务器硬件运维x年x月巡检报告-XXX-模板.pdf

    服务器硬件运维x年x月巡检报告-XXX-模板.pdf服务器硬件运维x年x月巡检报告-XXX-模板.pdf服务器硬件运维x年x月巡检报告-XXX-模板.pdf服务器硬件运维x年x月巡检报告-XXX-模板.pdf服务器硬件运维x年x月巡检报告-XXX-...

    服务器硬件运维x年x月巡检报告-XXX-模板.docx

    服务器硬件运维x年x月巡检报告-XXX-模板.docx服务器硬件运维x年x月巡检报告-XXX-模板.docx服务器硬件运维x年x月巡检报告-XXX-模板.docx服务器硬件运维x年x月巡检报告-XXX-模板.docx服务器硬件运维x年x月巡检报告-XXX...

    服务器硬件运维x年x月巡检工作报告-XXX-模板.pdf

    服务器硬件运维x年x月巡检工作报告-XXX-模板.pdf服务器硬件运维x年x月巡检工作报告-XXX-模板.pdf服务器硬件运维x年x月巡检工作报告-XXX-模板.pdf服务器硬件运维x年x月巡检工作报告-XXX-模板.pdf服务器硬件运维x年x月...

Global site tag (gtag.js) - Google Analytics