block学习(一)

1.定义block的两种方式:

  -直接定义:

    //@property (nonatomic,copy) void (^callBack)(NSInteger index,id info);

  -type定义,重用

    typedef void (^callBack)(NSInteger index,id info);

    @property (nonatomic,strong) callBack callBack;

2.代码中使用:  

    if (_callBack) {

        _callBack(centerImageIndex,_imageModels[centerImageIndex]);

    }

posted on 2015-07-06 09:46  彪biao  阅读(130)  评论(0编辑  收藏  举报

导航