block 用法

2016.1.13

1.(1)或(2)

(1)__weak typeof(self) weakSelf = self;

(2)__weak UIViewController *weakSelf = self;

2016.3.17

在.h 中

typedef void (^MyExerciseBlock) (NSString *string,CGFloat height); // 定义 block ---无返回值 2个参数

@interface SenceTableCell : UITableViewCell<UITextViewDelegate>

 

@property (nonatomic,copy)      MyExerciseBlock cellBlock;// 声明block 

 - (void)updateCellData:(NSString *)string heitht:(CGFloat )height img:(NSString*)img;// 刷新cell 

@end

 .m  调用的时候

  _MyExerciseBlock(_titleView.text,_titleHeight);

 

其它地方实现

xxx.MyExerciseBlock = ^(string,heitht){

 

    //实现的功能


};

 

posted @ 2016-01-13 17:28  徒步阳光855  阅读(159)  评论(0编辑  收藏  举报