eraser not working in iOS drawing
===

I am working with drawing in iOS, everything works fine, but **I have a eraser bug, only** when I perform undo and redo, i,e whenever I draw something and press undo and then again redo, and now when I try to use eraser, all the content of redo  will be lost in one go and I will not get eraser effect.I m not understanding where I am goin wrong, so please help me out

Below is my code


    - (void)drawRect:(CGRect)rect
    {
                   
            case ERASE:
            {
                [m_curImage drawAtPoint:CGPointMake(0, 0)];
                CGContextRef context = UIGraphicsGetCurrentContext(); 
    
               CGContextClearRect(context, rect);
                
                CGContextSetBlendMode(context, kCGBlendModeClear);
                [super drawRect:rect];
                break;                
               
      }      
                
               
            case UNDO:
            {
                [m_curImage drawInRect:self.bounds];
                 break;
               
            }
                
            case REDO:
            {
                [m_curImage drawInRect:self.bounds];  
                 break;           
            }
               
                
            default:
                break;
        }    
    }

please tell me whether I am doing it right


Regards
Ranjit


