YYText源码阅读
一、基础知识
- (void)setFont:(UIFont *)font {
[self _makeMutableAttributes];
if (font == (id)[NSNull null] || font == nil) {
((NSMutableDictionary *)_attributes)[(id)kCTFontAttributeName] = [NSNull null];
} else {
CTFontRef ctFont = CTFontCreateWithName((__bridge CFStringRef)font.fontName, font.pointSize, NULL);
if (ctFont) {
((NSMutableDictionary *)_attributes)[(id)kCTFontAttributeName] = (__bridge id)(ctFont);
CFRelease(ctFont);
}
}
}
- CFRelease:
If the retain count of cf
becomes zero the memory allocated to the object is deallocated and the object is destroyed. If you create, copy, or explicitly retain (see the CFRetain function) a Core Foundation object, you are responsible for releasing it when you no longer need it
如果是你创建、copy、或明确保留(explicitly retain (see the CFRetain function))的一个Core Foundation对象,你需要用CFRelease方法去释放这个Core Foundation对象。
本文标题:YYText源码阅读
本文链接:https://www.haomeiwen.com/subject/vkpeuqtx.html
网友评论