A primera vista, mi pregunta parece muy simple, pero parece que realmente no puedo encontrar una solución. Esto es lo que es: Quiero calcular el cuadro delimitador de una cadena CATextLayer. Aquí es lo que hago:¿Cómo se calcula el cuadro delimitador de una cadena CATextLayer?
CATextLayer *textLayer = [CATextLayer layer];
textLayer.frame = CGRectMake(80, 0.0f, 36.0f, 18.0f);
textLayer.string = @"12";
textLayer.fontSize = [UIFont systemFontSize];
textLayer.foregroundColor = [UIColor whiteColor].CGColor;
NSLog(@"(width,height)=(%f,%f)",
[textLayer.string sizeWithFont:textLayer.font].width,
[textLayer.string sizeWithFont:textLayer.font].height);
El problema es que la salida es siempre: (anchura, altura) = (8.000000,0.000000)