16 May 2012, 07:55
Profilbild_bernd_rabe_pragsmall

Bernd Rabe (23 posts)

When I decided to convert my project and hence some part of “iOS Recipes” as well to arc I run into a problem I couldn’t solve up to now.

Hope one of you can help me out.

- (void)drawRect:(CGRect)rect {
	if (self.attributedText == nil) 
		return;
    
	CGContextRef context = UIGraphicsGetCurrentContext(); 		
	CGContextSaveGState(context);
	CGContextTranslateCTM(context, self.bounds.size.width/2, self.bounds.size.height);
	CGContextScaleCTM(context, 1.0, -1.0);
	CTLineRef line = CTLineCreateWithAttributedString((__bridge CFAttributedStringRef)self.attributedText);
	CGContextSetTextPosition(context, ceill(-self.bounds.size.width/2), ceill(self.bounds.size.height/4));
	CTLineDraw(line, context);
	CGContextRestoreGState(context);	
	CFRelease(line);	
}


Crashes on CTLineDraw with 
*** -[Not A Type _cfTypeID]: message sent to deallocated instance 0xe6a1f00
which is the attributedText iVAR.
  You must be logged in to comment