Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我对 Blocks 的概念有点熟悉,但我不知道如何在 iOS5 中创建它们。谁能给我一个简单的例子?非常感激 :)
在 Blocks 中使用这个简单的例子。
int multiplier = 7; int (^myBlock)(int) = ^(int num) { return num * multiplier; }; NSLog(@"Sum = %d",myBlock(20)); Then you will get as 140
这是一个简单的例子。希望能帮助到你。
void (^name)(void) = ^ { //insert code here };