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