定义
typedef void (^RFAudioBasicBlock) (void); typedef void (^RFAudioSuccessBlock) (BOOL flag); typedef void (^RFAudioSuccessDetailBlock) (BOOL flag, NSURL *url, NSTimeInterval duration); typedef void(^RFAudioSuccessURLBlock) (BOOL flag, NSURL *url);
作为参数
- (void)playWithURL:(NSURL *)url finishedBlock:(RFAudioSuccessDetailBlock)block;
使用
[[RFAudioManager defaultManager] playWithURL:url finishedBlock:^(BOOL flag, NSURL *url) { NSLog(@"播放结束:%@", url); }];
原文:http://www.cnblogs.com/ihojin/p/use-block.html