我正在尝试传递一个UILabel
withAudioServicesAddSystemSoundCompletion
但我无法操纵completionCallback
方法中的值。我正在使用 ARC,Xcode 建议添加(_bridge void*)
.
任何帮助将非常感激。
-(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];
}