【发布时间】:2012-05-24 01:51:47
【问题描述】:
我正在尝试使用AudioServicesAddSystemSoundCompletion 传递UILabel,但我无法在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];
}
【问题讨论】:
标签: iphone objective-c ios ipad audio