码迷,mamicode.com
首页 > 其他好文 > 详细

block学习(一)

时间:2015-07-06 10:06:32      阅读:115      评论:0      收藏:0      [点我收藏+]

标签:

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]);

    }

block学习(一)

标签:

原文地址:http://www.cnblogs.com/luanmage/p/4623545.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!