첫눈에 제 질문은 정말 간단 해 보이지만 해결책을 찾지 못하는 것 같습니다. 다음은 같습니다 : CATextLayer의 문자열 경계 상자를 계산하고 싶습니다. 여기 내가 할 것입니다 :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);
문제는 출력이 항상 있다는 것입니다 : (폭, 높이) = (8.000000,0.000000)