0
我開發了一個簡單的應用程序,其中設計或製作代碼,在其中創建和實例對象的UIImage。當我在Ipad屏幕上進行拖動時,它組成了屏幕的圖像,然後將圖像渲染到UIImage對象中,然後將此圖像設置爲UIImageView對象和UIimage對象。 每次我在屏幕上滑動,上面的過程一次又一次。但它給我泄漏renderImage = [[UIImage alloc] init];
。我如何解決內存泄漏問題?
代碼,
_renderImage = [[UIImage alloc] init];
_textImageV = [[UIImageView alloc] init];
[self renderIntoImage];
-(void)renderIntoImage
{
UIGraphicsBeginImageContext(bgTableView.bounds.size);
[self.view.layer renderInContext:UIGraphicsGetCurrentContext()];
_renderImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
}
_textImageV.image = _renderImage;
[_renderImage release];
完成輕掃我還釋放_textImageV的處理之後。
我如何解決UIImage * _renderImage中的內存泄漏問題?
謝謝。它現在很好地工作... – Tirth 2010-12-22 07:56:06
我們如何在將它分配給別的東西之前釋放它? – 2014-02-17 07:25:59
這是否適用於ARC?如果是這樣,我們如何釋放它? – 2015-10-21 08:56:09