CTFontRef font = CTFontCreateWithName((__bridge CFStringRef)boldSystemFont.fontName, boldSystemFont.pointSize, NULL);
NSRange rangeHighlight = NSMakeRange(range.location, substringToHighlight.length);
if (font) {
[mutableAttributedString addAttribute:(NSString *)kCTFontAttributeName value:(__bridge id)font range:rangeHighlight];
CFRelease(font); //Is this still necessary?
}
I copy and paste this code from https://github.com/mattt/TTTAttributedLabel
CTFontRef font = CTFontCreateWithName((CFStringRef)boldSystemFont.fontName, boldSystemFont.pointSize, NULL);
if (font) {
[mutableAttributedString addAttribute:(NSString *)kCTFontAttributeName value:(id)font range:boldRange];
[mutableAttributedString addAttribute:@"TTTStrikeOutAttribute" value:[NSNumber numberWithBool:YES] range:strikeRange];
CFRelease(font);
}
When I do that I got an error saying that I got to use the keyword __bridge. What is it? I put it and compile error stop. But then I wonder if I still need to use CFRelease(font)
In addition
- What is CF in CFRelease?
- What is __bridge?
- Should I do CFRelease(font) after using __bridge?
- Where can I learn more about this?