Foro de elhacker.net

Programación => Programación General => Mensaje iniciado por: Riki_89D en 12 Noviembre 2012, 00:03 am



Título: Problema Objective-C xCode [iOS]
Publicado por: Riki_89D en 12 Noviembre 2012, 00:03 am
Hola,que tal,veran tengo un codigo en O-C,que en la pantalla hay un componente UIView con un fondo de imagen PNG,el caso es que yo he creado los archios "h" y "m" que controlan ese control,y todo perfecto,puedo dibujar en ese UIView,pero nose como hacer qu se borre solo lo que he dibujado (no el fondo del UIView,que es una imagen PNG) necesito hacer eso desde la clase UIViewController,desde esta clase tengo que borrar lo que he dibujado en un UIView,sin borrar el fondo de este UIView,solo las lineas que he dibujado,alguien puede ayudarme? gracias



aqui pongo codigo:

Archivo de implementacion del UIView,este me permite dibujar en u UIView que iene una imagen de fondo
Código:
- (void)drawRect:(CGRect)rect
{

    CGContextRef context = UIGraphicsGetCurrentContext();
   
    CGPathMoveToPoint(path, NULL, previousPoint.x, previousPoint.y);
    CGPathAddLineToPoint(path, NULL, lastPoint.x, lastPoint.y);
    CGContextAddPath(context, path);
    CGContextSetLineWidth(context, 2.0);
    [[UIColor blackColor] setStroke];
    CGContextDrawPath(context, kCGPathFillStroke);
   
   
}

- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
    lastPoint = [[touches anyObject] locationInView:self];
    previousPoint = [[touches anyObject] previousLocationInView:self];
   
   [self setNeedsDisplay];
   
   
}

- (void)awakeFromNib
{
    path = CGPathCreateMutable();
}



ahora yo desde el archivo de implementacion del UIViewController,como borro lo quie he dibujado en el UIView sin borrar la imagen de fondo? gracias