zoukankan      html  css  js  c++  java
  • iphone, iphone4, ipad 图标和背景图片问题(转)

    比如iphone3 下用一张图片叫:sprite.png
    那么iphone4下如果想获得高清的,可再加一张2倍大小的 sprite@2x.png.(cocos2d下用sprite-hd.png)
    想同时在ipad下用,那么加一张适合ipad大小的图片,图片名自己取,
    然后在程序里用代码区别是不是ipad,再用相应的名字:

    #import "sys/utsname.h"  /*!
     *  get the information of the device and system
     *  "i386"          simulator
     *  "iPod1,1"       iPod Touch
     *  "iPhone1,1"     iPhone
     *  "iPhone1,2"     iPhone 3G
     *  "iPhone2,1"     iPhone 3GS
     *  "iPad1,1"       iPad
     *  "iPhone3,1"     iPhone 4
     *  @return null
     */ - (void)getDeviceAndOSInfo{     //here use sys/utsname.h     struct utsname systemInfo;
        uname(&systemInfo);
        //get the device model and the system version     NSLog(@"%@", [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding]);
        NSLog(@"%@", [[UIDevice currentDevice] systemVersion]);}


    另外,关于启动画面
    iPhone,iPhone4,iPad程序启动画面的总结
    iOS设备现在有三种不同的分辨率:iPhone 320x480, iPhone 4 640x960, iPad 768x1024。以前程序的启动画面(图片)只要准备一个Default.png就可以了,但是现在变得复杂多了。
    如果一个程序,既支持iPhone又支持iPad,那么它需要包含下面几个图片:
    Default-Portrait.png iPad专用竖向启动画面 768x1024或者768x1004
    Default-Landscape.png iPad专用横向启动画面 1024x768或者1024x748
    Default-PortraitUpsideDown.png iPad专用竖向启动画面(Home按钮在屏幕上面),可省略 768x1024或者768x1004
    Default-LandscapeLeft.png iPad专用横向启动画面,可省略 1024x768或者1024x748
    Default-LandscapeRight.png iPad专用横向启动画面,可省略 1024x768或者1024x748
    Default.png iPhone默认启动图片,如果没有提供上面几个iPad专用启动图片,则在iPad上运行时也使用Default.png(不推荐) 320x480或者320x460
    Default@2x.png iPhone4启动图片640x960或者640x920

    为了在iPad上使用上述的启动画面,你还需要在info.plist中加入key: UISupportedInterfaceOrientations。同时,加入值UIInterfaceOrientationPortrait, UIInterfacOrientationPortraitUpsideDown, UIInterfaceOrientationLandscapeLeft, UIInterfaceOrientationLandscapeRight。

    cocos2d 支持高清图片需要 cocos2d 0.99.5 以上版本才能支持。解决方案如下:

    • 准备 320×480 和 640×960 两种格式的图片。320×480 的图片取名为 bg.png,640×960 的图片取名为 bg-hd.png。
    • 修改程序的 app delegate,将 if( ! [director enableRetinaDisplay:YES] ) 这句代码的注释去掉。
  • 相关阅读:
    Asp.Net生命周期的详解
    Asp.Net生命周期的详解
    Asp.Net WebForm生命周期的详解
    【原创】Ajax的用法总结
    【】Ajax的用法总结
    【】Ajax的用法总结
    Indexing Sensor Data
    【】Ajax的用法总结
    25句张小娴经典爱情语录,句句穿心!
    25句张小娴经典爱情语录,句句穿心!
  • 原文地址:https://www.cnblogs.com/worldtraveler/p/2809862.html
Copyright © 2011-2022 走看看