when should you use __bridge vs. CFBridgingRelease/CFBridgingRetain?

前端 未结 2 1902
失恋的感觉
失恋的感觉 2020-12-16 13:34

I have this code that uses \"__bridge\" to cast the ids of colors:

  CGColorRef tabColor = (5 == 5
                         ? [UIColor blueColor].CGColor
            


        
2条回答
  •  醉酒成梦
    2020-12-16 14:00

    With NSURL is the same problem

    NSString *soundPath = [[NSBundle mainBundle] pathForResource:@"sound" ofType:@"wav"];
    NSURL *soundURL = [NSURL fileURLWithPath:soundPath];
    AudioServicesCreateSystemSoundID(CFBridgingRetain(soundURL), &soundEffect);
    

提交回复
热议问题