2
我不明白,如何解決問題? 我使用「分析」導致我的程序崩潰,由於內存問題,並且七個類似符號中的第一個是「存儲到Signalline中的對象的潛在泄漏」,與CGContextStrokePath(signalContext)相連;在循環中使用CGGraphics時物體的潛在泄漏
- (void)drawHorizoLines{
for(int i = 1; i < self.frame.size.width/_sw;i++){
CGContextRef signalContext = UIGraphicsGetCurrentContext();
CGMutablePathRef signalLine = CGPathCreateMutable();
CGContextSetLineWidth(signalContext, 0.4); //LineWidth
CGContextBeginPath(signalContext);
CGContextSetStrokeColorWithColor(signalContext, [UIColor purpleColor].CGColor);
CGPathMoveToPoint(signalLine, 0, 0, i*_rowHeigth + _sbd/2);//Startpoint
CGPathAddLineToPoint(signalLine, 0, self.frame.size.width, i*_rowHeigth + _sbd/2);
CGContextAddPath(signalContext, signalLine);
//CGContextClosePath(signalLine); didnt work
CGContextStrokePath(signalContext);
//CGContextRelease(signalContext); didnt work
}
}
太棒了!用於快速解決方案 –