He intentado mostrar texto usando un contexto de Cuarzo, pero no importa lo que haya intentado, simplemente no he tenido suerte para mostrar el texto (sin embargo, puedo mostrar todo tipo de otros objetos de Cuarzo) . ¿Alguien sabe lo que podría estar haciendo mal?¿Cómo mostrar texto usando Quartz en el iPhone?
ejemplo:
-(void)drawRect:(CGRect)rect
{
// Drawing code
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSelectFont(context, "Arial", 24, kCGEncodingFontSpecific);
CGContextSetTextPosition(context,80,80);
CGContextShowText(context, "hello", 6);
//not even this works
CGContextShowTextAtPoint(context, 1,1, "hello", 6);
}
Debe ser @ "Texto de muestra" ya que la función espera un NSString *. A mí me funciona de otra manera, gracias. Sin embargo, no puedo encontrar referencia a la función drawAtPoint, lo cual es preocupante. – CiscoIPPhone
drawAtPoint es parte de la categoría UIKit NSString - http://developer.apple.com/library/ios/#documentation/uikit/reference/NSString_UIKit_Additions/Reference/Reference.html – Hunter