iOS: 定义 Block

 定义

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

 

posted @ 2014-06-24 19:34  有妄想症的猫zz  阅读(8595)  评论(0编辑  收藏  举报