How Do I Declare A Block in Objective-C?
来源:互联网 发布:nginx lua配置 编辑:程序博客网 时间:2024/06/05 17:36
How Do I Declare A Block in Objective-C?
As a local variable:
returnType (^blockName)(parameterTypes) = ^returnType(parameters) {...};
As a property:
@property (nonatomic, copy) returnType (^blockName)(parameterTypes);
As a method parameter:
- (void)someMethodThatTakesABlock:(returnType (^)(parameterTypes))blockName;
As an argument to a method call:
[someObject someMethodThatTakesABlock: ^returnType (parameters) {...}];
As a typedef:
typedef returnType (^TypeName)(parameterTypes);
TypeName blockName = ^returnType(parameters) {...};
This site is not intended to be an exhaustive list of all possible uses of blocks.
If you find yourself needing syntax not listed here, it is likely that a typedef would make your code more readable.
Unable to access this site due to the profanity in the URL? http://goshdarnblocksyntax.com is a more work-friendly mirror.
If you find yourself needing syntax not listed here, it is likely that a typedef would make your code more readable.
Unable to access this site due to the profanity in the URL? http://goshdarnblocksyntax.com is a more work-friendly mirror.
0 0
- How Do I Declare A Block in Objective-C?
- How Do I Declare A Block in Objective-C?
- How Do I Declare A Block in Objective-C? [备忘]
- How Do I Declare A Block in Objective-C?
- How Do I Declare a Closure in Swift?
- How do I create delegates in Objective-C?
- How do i declare a 2d array using new?
- How do I register a custom filetype in iOS【链接】
- How do I run a 64-bit guest in VirtualBox?
- How do I instantiate a Queue object in java?
- How do I hide a menu item in the actionbar?
- How do I deploy a Flask application in IIS?
- How do I call a C++ function from C?
- How do I read in a character variable with varying length in a space delimited dataset?
- How do I read in a character variable with varying length in a space delimited dataset?
- How do I install a file in my local repository along with a generic POM?
- How do I debug JavaScript in Safari?
- How do I use Cygwin in Geophysics ?
- 搭建coreseek(sphinx+mmseg3)详细安装配置+php之sphinx扩展安装+php调用示例
- fuser命令
- ASP.NET Ajax实现图片剪裁
- uva 10700
- 百度地图讲解参考
- How Do I Declare A Block in Objective-C?
- 程序员的幽默
- 【Java学习】泛型接口学习
- 学习CSS了解单位em和px的区别
- 如何获取系统样式com.android.internal.R
- MySQL 数据库简单操作
- 笔记11 数组
- ProtelDXP电子电路设计
- 黑马程序员——冒泡排序