I m试图通过UILabel
with AudioservicesAddSystemSoundCompletion
,但i m无法操纵completionCall
方法中的价值。 使用ARC和X密码的Im建议添加<代码>(_bridge void*)。
Any help would be much appreciated.
-(void) playWordSound:(UILabel *)label
{
NSString *path;
SystemSoundID soundId;
switch (label.tag)
{
case 1:
..........
break;
}
NSURL *url = [NSURL fileURLWithPath:path];
AudioServicesCreateSystemSoundID( (CFURLRef)objc_unretainedPointer( url), &soundId);
AudioServicesPlaySystemSound(soundId);
AudioServicesAddSystemSoundCompletion (soundId, NULL, NULL,
completionCallback,
(__bridge void*) label);
}
static void completionCallback (SystemSoundID mySSID, void* data) {
NSLog(@"completion Callback");
AudioServicesRemoveSystemSoundCompletion (mySSID);
//the below line is not working
//label.textColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:1];
}