How do blocks differ from normal methods and functions in Objective-C?

后端 未结 2 1661
栀梦
栀梦 2021-02-02 17:32

What is the advantage of using blocks over normal methods and functions in Objective-C? I\'ve read the documentation, but I can\'t find specific uses of blocks instead of other

2条回答
  •  不要未来只要你来
    2021-02-02 17:45

    I like Apple's "A Short Practical Guide to Blocks" as an introduction to the concept.

    In addition, almost all of the resources pointed to in response to the question "Suggested resources for learning about blocks in Snow Leopard" would apply here.

    On top of the resources there, I recommend the articles "Cocoa for Scientists (Part XXVII): Getting Closure with Objective-C" and "Cocoa for Scientists (XXXIII): 10 Uses for Blocks in C/Objective-C" by Drew McCormack, as well as "Programming with C Blocks" by Joachim Bengtsson.

    The WWDC 2010 videos for sessions 206 - "Introducing Blocks and Grand Central Dispatch on iPhone" and 211 - "Simplifying iPhone App Development with Grand Central Dispatch" are well worth watching too.

提交回复
热议问题