At first sight my question looks really simple, but it seems that I really can't find solution. Here is what it is: I want to calculate the bounding box of a CATextLayer's string. Here is what I do:
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);
The problem is that the output is always : (width,height) = (8.000000,0.000000)