x 및 y는 정수입니다.iOS는 CGcontextshowtextatpoint를 사용할 때 텍스트의 특정 글꼴에 대해 직사각형을 그립니다.
int theSize = [caption.text length];
CGContextShowTextAtPoint(context, x, y, [caption.text UTF8String], theSize);
을하지만 특정 글꼴을 사용할 때 문자가 사각형으로 표시 : 나는 CGBitmapCreateContext를 사용하여 사용자 정의 만든 컨텍스트를 보낸 다음 ArialMT 같은 일반적인 글꼴을 사용할 때
다음 코드는 잘 작동합니다.
// supposedly a solution to glyphs problem
CGContextSaveGState(context);
CGContextSetRGBFillColor(context, 0, 0, 0, .5);
[caption.text drawAtPoint:CGPointMake(x, y) withFont:caption.font];
CGContextRestoreGState(context);
하지만 그건 단지 나에게 오류 제공 : 9월 7일 13시 33분 31초 ... : CGContextShowGlyphsWithAdvances : 그래서 다른 스택 오버플로 답변을 사용하는 CoreText 인 제안 일을 시도 무효 컨텍스트를 0x0