首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 移动开发 > 移动开发 >

OC得Block语法施用

2013-09-08 
OC得Block语法使用////main.m//Block////Created by Rayln Guan on 8/29/13.//Copyright (c) 2013 Rayln G

OC得Block语法使用

////  main.m//  Block////  Created by Rayln Guan on 8/29/13.//  Copyright (c) 2013 Rayln Guan. All rights reserved.//#import <Foundation/Foundation.h>typedef int (^MySum) (int, int);void test1(){    int (^Sum) (int, int) = ^(int a, int b){        return a + b;    };    NSLog(@"%i", Sum(2, 3));}void test2(){    MySum sum = ^(int a, int b){        return a + b;    };    NSLog(@"%i", sum(10, 2));}int main(int argc, const char * argv[]){    @autoreleasepool {        test1();        test2();            }    return 0;}

热点排行