我正在使用CGLayer,所以现在我正在实现 ClearAll 和擦除功能,clearAll工作正常,但我的擦除几乎没有问题,它部分工作,
下面是我的代码
- (void)drawRect:(CGRect)rect
{
if (m_clearAll)
{
//here myLayerRef is the my member variable
CGContextRef layercontext = CGLayerGetContext(myLayerRef);
CGContextClearRect(layercontext , rect);
}
if (m_erase)// trying to get typical eraser effect
{
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextDrawLayerAtPoint(context, CGPointMake(0, 0), myLayerRef);
CGContextRef context1 = CGLayerGetContext(myLayerRef);
CGContextClearRect(context1 , rect);
[super drawRect:rect];
}
}
有谁知道我错过了什么?
此致 兰吉特