IOS Block Programming Guide 1 Introduction

Source: Internet
Author: User

Introduction (Introduction)

Block objects is a c-level syntactic and runtime feature. They is similar to standard C functions, but addition to executable code they could also contain variable bindings to AU Tomatic (Stack) or managed (heap) memory. A block can therefore maintain a set of state (data) which it can use for impact behavior when executed.

The Block object is a C-language-level syntax and runtime feature. They are similar to standard C functions, but in addition to executable code, they can contain variables for stack (stack, system to automatically manage memory) or memory in heap (heap, manually manage memory). A block can hold a setting on the state (data), so blocks can use these settings to affect behavior when executed.

You can use the blocks to compose function expressions The can is passed to API, optionally stored, and used by multiple thre Ads. Blocks is particularly useful as a callback because the block carries both the code to being executed on callback and the DA Ta needed during that execution.

You can use blocks to assemble function expressions to pass to the API, store them arbitrarily, and be used by multiple threads. Block is often used as a callback function because the block has both the code to execute the callback and the corresponding required data.

Blocks is available in GCC andClangAs shipped with the OS X v10.6 Xcode developer tools. You can use the blocks with OS X v10.6 and later, and IOS 4.0 and later. The blocks runtime is open source and can be found inLLVM ' s compiler-rt subproject repository. Blocks has also been presented to the C Standards Working Group asN1370:apple ' s Extensions to C. As Objective-c and C + + is both derived from C, blocks is designed to work with all three languages (as well as Objective -c++). The syntax reflects this goal.

The block is allowed in the Xcode developer tool in OS X 10.6 with GCC and clang. You can use block in OS X v10.6 and IOS 4.0 and later. The block runtime is open source and you can find it in LLVM ' s Compiler-rt subproject repository. Block is also shown in standard C work: N1370:apple'sExtensions to C. Because both Objective-c and C + + are derived from C,block are designed to work in these three languages (also available in objective-c++). Block's syntax achieves this goal.

You should read the document to learn what block objects is and how can use them from C, C + +, or objective-c.

You should read this document to learn what a block object is, and how you can use block in c,c++,objective-c.

Organization of this document (organization of block documents)

This document contains the following chapters:

  • Getting Started with Blocks provides a quick, practical, Introduction to Blocks.

  • Conceptual Overview provides a conceptual introduction to blocks.

  • declaring and Creating Blocks shows how to declare block variables and what to implement Blocks.

  • Blocks and Variables describes the interaction between Blocks and Variables, and defines the __block storage type M Odifier.

  • Using Blocks illustrates various usage patterns.

The documentation includes the following chapters:
  • Getting Started with Blocks provides a quick and practical block introduction
  • Conceptual Overview provides an introduction to the conceptual block
  • declaring and Creating Blocks tell you how to define and implement block
  • Blocks and Variables describes the intrinsic relationship between blocks and variables, and defines modifications to the _block storage type
  • Using Blocks describes the different usage patterns of the block
This article original, reproduced please indicate the source: http://blog.csdn.net/zhenggaoxing/article/details/44302505

IOS Block Programming Guide 1 Introduction

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.