diff --git a/_posts/2013/2013-03-11-core-text.md b/_posts/2013/2013-03-11-core-text.md index ced2901..110d3b2 100644 --- a/_posts/2013/2013-03-11-core-text.md +++ b/_posts/2013/2013-03-11-core-text.md @@ -201,6 +201,8 @@ callbacks的结构体为CTRunDelegateCallbacks,主要是包含一些回调函 CTRunDelegateRef runDelegate = CTRunDelegateCreate(&imageCallbacks, taobaoImageName); NSMutableAttributedString *imageAttributedString = [[NSMutableAttributedString alloc] initWithString:@" "];//空格用于给图片留位置 [imageAttributedString addAttribute:(NSString *)kCTRunDelegateAttributeName value:(id)runDelegate range:NSMakeRange(0, 1)]; + CFRelease(runDelegate); + [imageAttributedString addAttribute:@"imageName" value:taobaoImageName range:NSMakeRange(0, 1)]; [attributedString insertAttributedString:imageAttributedString atIndex:1]; @@ -251,6 +253,10 @@ callbacks的结构体为CTRunDelegateCallbacks,主要是包含一些回调函 } } } + + CFRelease(ctFrame); + CFRelease(path); + CFRelease(ctFramesetter); } {% endhighlight %}