包含iphone4在内的icon,default及图片处理方法


/ Published in: iPhone
Save to your folder(s)



Copy this code and paste it in your HTML
  1. 从icon说起
  2. 命名方法,举例
  3. Icon.png 57×57
  4. Icon-72.png 72×72
  5. Icon-Small.png 29×29
  6. Icon-Small-50.png 50×50
  7. [email protected] 114×114
  8. Icon-[email protected] 58×58
  9.  
  10. 另
  11. iTunesArtwork 512×512
  12.  
  13. 在info.plist使用key CFBundleIconFiles,注意与CFBundleIconFile区分开,CFBundleIconFiles的优先级高于CFBundleIconFile
  14. 省略扩展名,直接写Icon,会自动识别
  15. 如果要加扩展名,必须把所有的图片名都添加到CFBundleIconFiles的array中
  16. 特别需要注意的是,如果想自动识别,命名必须严格按照标准,且key为string类型。如果不自动识别,key为array类似并将完整文件名添加进去
  17.  
  18.  
  19. Default命名方法
  20.  
  21. <basename><orientation_modifier><scale_modifier><device_modifier>.png
  22.  
  23. 这个就不多说了,方法和icon是一样的,只列出相关的后缀
  24.  
  25. <basename>默认为Default,也可用UILaunchImageFile key设置,在这用Default举例
  26. <orientation_modifier> 旋转方向
  27.  
  28. -PortraitUpsideDown
  29. -LandscapeLeft
  30. -LandscapeRight
  31. -Portrait
  32. -Landscape
  33. None
  34.  
  35. 也就是说你可以Default-Portrait.png 来表示竖屏时的加载图像,同样也可以直接Default.png不指定方向
  36.  
  37. <scale_modifier>依然是为iphone4准备,用法和icon雷同
  38. Default-Portrait.png与Default-[email protected]会自动识别
  39.  
  40. <device_modifier>区分设备,有2个值
  41. ~iphone
  42. ~ipad
  43. Default-Portrait~iphone.png与Default-Portrait~ipad.png会自动判断设备 同样需要注意的一点,这个在icon里面同样适应,但是貌似现在没有使用的必要,看来未来ipad的分辨率也会扩充一倍?
  44.  
  45.  
  46. 如果使用了Custom URL Schemes,不多说了,格式如下,用法同上
  47. <basename>-<url_scheme><scale_modifier><device_modifier>.png
  48. 如:
  49. Default-myscheme.png与Default-[email protected]
  50.  
  51. 图片:
  52. 如果你的资源目录下有Button.png与[email protected]两张图片
  53. 那么使用:
  54. UIImage* anImage = [UIImage imageNamed:@"Button"];
  55. 将会自动识别图片加载

URL: http://www.cocoachina.com/bbs/read.php?tid-24549.html

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.