核心基金会和ARC

时间:2013-11-26 15:19:12

标签: ios memory-management automatic-ref-counting core-foundation

我在UIView子类

中有这样的属性
@property(nonatomic, assign) CTTypesetterRef typesetter;

我在视图构造函数中启动了TypeSetter:

- (id)initWithFrame:(CGRect)frame andAttributedString:(NSMutableAttributedString * )   pageAttributedString
{
    self = [super initWithFrame:frame];
    if (self) {
            self.attributedString = pageAttributedString;
            self.typesetter = CTTypesetterCreateWithAttributedString((CFAttributedStringRef)CFBridgingRetain(self.attributedString));
}

问题是在哪里使用CFRelease释放TypeSetter?

我正在使用ARC,IOS 7和Xcode 5

1 个答案:

答案 0 :(得分:1)

在您的-dealloc中,就像您使用MRR一样。

请记住,与MRR不同,在ARC中,您无需致电[super dealloc],也无需在ARC托管的ivars上明确调用-release