그래, CGContextSetDrawingMode(CGContextRef, CGTextDrawingMode)
의 도움으로 윤곽선이 표시된 텍스트를 표시 할 수 있습니다.하지만 모양이 좋게하려면 숫자와 색상을 조정해야 할 수 있습니다.
kCGTextFillStroke를 사용하는 것이 논리적 인 것처럼 보이지만 획이 채우기를 압도적으로 만들 수 있습니다. 스트로크 한 다음 아래 블록에서와 같이 채우면 읽을 수있는 텍스트 뒤에 눈에 띄는 윤곽이 나타납니다.
CGContextRef context = UIGraphicsGetCurrentContext();
CGPoint point = CGPointMake(0,30);
CGFloat fontSize = (3 * MKRoadWidthAtZoomScale(zoomScale));
UIFont *font = [UIFont fontWithName:@"Helvetica-Bold" size:fontSize];
// Draw outlined text.
CGContextSetTextDrawingMode(context, kCGTextStroke);
// Make the thickness of the outline a function of the font size in use.
CGContextSetLineWidth(context, fontSize/18);
CGContextSetStrokeColorWithColor(context, [[UIColor redColor] CGColor]);
[text drawAtPoint:point withFont:font];
// Draw filled text. This will make sure it's clearly readable, while leaving some outline behind it.
CGContextSetTextDrawingMode(context, kCGTextFill);
CGContextSetFillColorWithColor(context, [[UIColor blueColor] CGColor]);
[text drawAtPoint:point withFont:font];
많은 감사합니다 !! : 나는 다음 코드로 작동시킬 수 있었다 – user836026
제 경우에는 작동하지 않습니다. 동일한 단계를 밟았습니다. –