En iOS, podemos trazar una línea en drawRect
usandoEn iOS, ¿por qué el dibujo de UIBezierPath no requiere un contexto?
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextBeginPath (context);
CGContextMoveToPoint(context, 0, 0);
CGContextAddLineToPoint(context, 100, 100);
CGContextStrokePath(context);
pero también puede dibujar un rectángulo si quitamos el código anterior, y sólo tiene que utilizar:
preguntasUIBezierPath *path = [UIBezierPath bezierPathWithRect:CGRectMake(0, 0, 100, 100)];
[path stroke];
dos relacionadas:
1) ¿Por qué no necesita UIBezierPath
obtener o usar el contexto actual?
2) ¿Qué pasa si tengo dos contextos: uno para la pantalla, y uno es un contexto de mapa de bits, entonces, ¿cómo saber qué contexto dibujar para UIBezierPath
? Pensé que podría ser UIGraphicsSetCurrentContext
pero no existe.
por lo que sería usar 'UIGraphicsPushContext (myBitmapContext);' para empezar a dibujar en un contexto de mapa de bits? –
@ 動靜 能量: es correcto –