Я создаю пользовательскую ячейку в моем iphone aap, и я также добавляю к ней изображение, но продолжаю получать ошибку в [image drawatpoint: p];
состояния ошибки
*** - [UIImage drawAtPoint:]: сообщение отправлено на освобожденный экземпляр 0x45cb1f0
мой код
-(void)setImage:(UIImage *)i
{
//[image release];
image = i;
[self setNeedsDisplay];
}
- (void)setNeedsDisplay
{
[super setNeedsDisplay];
[contentView setNeedsDisplay];
}
- (void)drawContentView:(CGRect)r
{
CGContextRef context = UIGraphicsGetCurrentContext();
UIColor *backgroundColor = [UIColor yellowColor];
UIColor *textColor = [UIColor blackColor];
if(self.selected)
{
backgroundColor = [UIColor clearColor];
textColor = [UIColor whiteColor];
}
[backgroundColor set];
CGContextFillRect(context, r);
CGPoint p;
p.x = 3;
p.y = 3;
[textColor set];
UIImage *image2 = image;
[image2 drawAtPoint:p];
p.x += 70; // space between words
[text2 drawAtPoint:p withFont:firstTextFont];
//[image release];
}