对于我正在构建的应用程序,我绘制了2个圆圈.一个比另一个大一点.我想在这些行之间弯曲文本,以便建立一个圆形菜单.
我阅读了关于弯曲文本的大部分内容,你必须将文本分成字符,然后用正确的角度绘制每个字符(通过旋转你正在绘制的上下文).
我无法绕过如何为我的角色获得正确的角度和位置.
我在屏幕截图中列出了目前菜单的样子.只有我添加的文本是从UIImageView中的图像加载的.

我希望有人可以在某些方面为我提供一些关于如何在白色圆圈中绘制文字的起点.
编辑:好的,我目前正在这一点上:

我通过使用以下代码完成:
- (UIImage*) createMenuRingWithFrame:(CGRect)frame
{
CGRect imageSize = CGRectMake(0,0,300,300);
float perSectionDegrees = 360 / [sections count];
float totalRotation = 90;
char* fontName = (char*)[self.menuItemsFont.fontName cStringUsingEncoding:NSASCIIStringEncoding];
CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB();
CGContextRef context = CGBitmapContextCreate(NULL, imageSize.size.width, imageSize.size.height, 8, 4 * imageSize.size.width, colorSpace, kCGImageAlphaPremultipliedFirst);
CGContextSetTextMatrix(context, CGAffineTransformIdentity);
CGContextSelectFont(context, fontName, 18, kCGEncodingMacRoman);
CGContextSetRGBFillColor(context, 0, 0, 0, 1);
CGPoint centerPoint = CGPointMake(imageSize.size.width / 2, imageSize.size.height / 2);
double radius = (frame.size.width / 2);
CGContextStrokeEllipseInRect(context, CGRectMake(centerPoint.x - (frame.size.width / 2), centerPoint.y …Run Code Online (Sandbox Code Playgroud)