yo era capaz de dibujar un cuadro de líneas discontinuas, con el siguiente código:dibujo línea discontinua usando CALayer
CAShapeLayer *shapeLayer = [CAShapeLayer layer];
CGRect shapeRect = CGRectMake(0.0f, 0.0f, 200.0f, 100.0f);
[shapeLayer setBounds:shapeRect];
[shapeLayer setPosition:CGPointMake(self.coreImageView_.frameX, self.coreImageView_.frameBottom - self.coreImageView_.frameHeight/2)];
[shapeLayer setFillColor:[[UIColor clearColor] CGColor]];
[shapeLayer setStrokeColor:[[UIColor whiteColor] CGColor]];
[shapeLayer setLineWidth:2.0f];
[shapeLayer setLineJoin:kCALineJoinRound];
[shapeLayer setLineDashPattern:
[NSArray arrayWithObjects:[NSNumber numberWithInt:5],
[NSNumber numberWithInt:5],
nil]];
Ahora si quiero simplemente dibujar una línea discontinua desde el punto X al punto B, ¿cómo debería modificar este código?
¿qué quiere decir con el punto X y el punto B? son puntos en su rectángulo o son solo 2 puntos en cualquier lugar de la pantalla? –
Posible duplicado [aquí] (http://stackoverflow.com/questions/12091916/uiview-with-a-dashed -line) –
http://stackoverflow.com/questions/12091916/uiview-with-a-dashed- line/12092002 # 12092002 –