1. .h文件。
block 无传入参数值,没有返回值
#import@interface BaseViewController : UIViewController
-(void)showError:(NSString *)errorMessage block:(void(^)(void))errorBlock;
@end
2. .h文件 。先定义Block,传入参数问 NSInteger 类型,无返回值
typedef void(^ButtonActionBlock)(NSInteger tag);
@interface XYRToolBar : UIToolbar
@property (nonatomic, copy) ButtonActionBlock buttonActionBlock;
-(void)buttonActionBlock:(ButtonActionBlock)didClickButton;
@end
网友评论