Blocks编程要点
来源:56doc.com 资料编号:5D12432 资料等级:★★★★★ %E8%B5%84%E6%96%99%E7%BC%96%E5%8F%B7%EF%BC%9A5D12432
资料以网页介绍的为准,下载后不会有水印.资料仅供学习参考之用. 密 保 惠 帮助
资料介绍
Blocks编程要点(中文3400字,英文3300字)
文章出处:Apple Inc.
摘要:本文简要的介绍iOS4.0新特性Blocks编程的要点,即Block入门,概念概述,声明和创建Blocks,Blocks和变量四大部分,本文档中包含许多原则或准则,并通过举例的方式对原则进行解释说明。
关键字:Blocks 对象 iOS
原文:
Introduction
Block objects are a C-level syntactic and runtime feature. They are similar to standard C functions, but in addition to executable code they may also contain variable bindings to automatic (stack) or managed (heap) memory. A block can therefore maintain a set of state (data) that it can use to impact behavior when executed.
You can use blocks to compose function expressions that can be passed to API, optionally stored, and used by multiple threads. Blocks are particularly useful as a callback because the block carries both the code to be executed on callback and the data needed during that execution. |