Using an Image for the Layer’s Content

Because a layer is just a container for managing a bitmap image, you can assign an image directly to the layer’s contents property. Assigning an image to the layer is easy and lets you specify the exact image you want to display onscreen. The layer uses the image object you provide directly and does not attempt to create its own copy of that image. This behavior can save memory in cases where your app uses the same image in multiple places.

The image you assign to a layer must be a CGImageRef type. (In OS X v10.6 and later, you can also assign an NSImage object.) When assigning images, remember to provide an image whose resolution matches the resolution of the native device. For devices with Retina displays, this might also require you to adjust the contentsScale property of the image. For information on using high-resolution content with your layers, see Working with High-Resolution Images.

最新文章

  1. MySQL Range Optimization
  2. 简单的java socket 示例
  3. Split Array Largest Sum
  4. sendEmail的使用
  5. IE11下Forms身份认证无法保存Cookie的问题
  6. 【codevs1409】 拦截导弹 2
  7. mongodb配置及简单示例
  8. html&css静态页面
  9. 2733: [HNOI2012]永无乡 - BZOJ
  10. POJ 3761 Bubble Sort(乘方取模)
  11. zTree实现地市县三级级联报错(一)
  12. poj 2411 Mondriaan's Dream(状态压缩dp)
  13. weblogic获取应用目录路径(war包)
  14. 3分钟看完Java 8——史上最强Java 8新特性总结之第三篇 函数式编程技巧
  15. Redis数据结构之哈希
  16. priority_queue的基本用法
  17. threaded_execution
  18. mongodb常用操作命令(待续)
  19. Java中一种无意识的递归
  20. HBase性能优化方法总结(二):写表操作

热门文章

  1. moment.js的方法总结
  2. P2939 [USACO09FEB]改造路Revamping Trails(分层图最短路)
  3. ios一个自定义的下拉多选菜单
  4. 笔记-迎难而上之Java基础进阶1
  5. kuangbin专题十二 HDU1029 Ignatius and the Princess IV (水题)
  6. thinkphp5.1 使用第三方扩展类库
  7. 小程序启用slot -- 传入 wxml标签
  8. Codeforces 350D(计算几何)
  9. Power BI
  10. excel单元格内容拆分