WebView の上に配置された UIView があります。この UIView で描画する必要がありますが、このエラーでアプリがクラッシュします
LibraryViewController.m 内
self.drawView =[[DrawView alloc]init];
self.drawView.frame=CGRectMake(0, 0, 1024, 768);
self.drawView.backgroundColor=[UIColor redColor];
self.drawView.alpha=0.5;
[self.webView addSubview:self.drawView];
DrawView.h 内
#import <UIKit/UIKit.h>
@interface DrawView : UIView
@end
DrawView.m 内
@implementation DrawView
{
UIImage *incrementalImage;
//......
}
- (void)eraseDrawing:(UITapGestureRecognizer *)t
{
incrementalImage = nil;
[self setNeedsDisplay];
}
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
//.....
[incrementalImage drawAtPoint:CGPointZero];
[[UIColor blackColor] setStroke];
[[UIColor blackColor] setFill];
[offsetPath stroke]; // ................. (8)
[offsetPath fill];
incrementalImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
[offsetPath removeAllPoints];
dispatch_async(dispatch_get_main_queue(), ^{
bufIdx = 0;
[self setNeedsDisplay];
});
});
//.....
}
- (void)drawRect:(CGRect)rect
{
[incrementalImage drawInRect:rect]; //Thread 1:EXC_BAD_ACCESS (code=1 address=0xa000008)
}
このアプリケーションは ARC を使用しません